0

I am trying look at the whole feed for one Google Contact being pulled down from Google via the Google API. It takes hours sometimes to explore and look to see if/where there is an additional item in the feed. I would like to be able to just dump the feed to a file for searching the feed for things like date and research what the date entry is about. One item I want to see if there is a date entry for when a contact was created rather than when the contact entry was updated.

I can dump a a contact by putting a breakpoint on the one of the t contract lines of my code but that takes a long time to expand all of the t entry on the Visual Studio panel.

How to write the feed to a file? This is more of just a base question of how to do this with a feed entry. Like how to take a feed and put it in a file.WriteLine(Feed.whatever) statement or equivalent.

I have also spent a fair amount of time searching stackoverflow for how to write a feed to a file.

Or, where is a real and complete schema of a Google Contact entry? Schemas.Google.com does not exist.

I have looked at the Google API V3 for hours. The info does not appear to be there.

Here is the basic code to work a feed and write out a couple of entries for each contact. This code works with the Google code downloaded with references added to it in C# Visual Studio Express. The email address and password along with an appropriate out file need to be specified.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Google.GData.Contacts;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.Contacts;
using System.Data;
using System.Data.SqlClient;
using System.IO;

//C# program - download Google Contacts and write out contact Ids used for pulling down a single google contact.
//download the google v3 api sample pack and add references to the code for the above google using statements.

namespace RefreshGoogleContactIDS
{
    class Program
    {
        static void Main(string[] args)
        {
            string conoutf = "C:\\Users\\myuser\\Contacts\\contactids.txt";
            StreamWriter con = new StreamWriter(conoutf);
            RequestSettings rs = new RequestSettings("Any title for program", "myemailaddresforgooglecontacts", "mypassword");
            rs.AutoPaging = true;
            ContactsRequest cr = new ContactsRequest(rs);
            ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default"));
            Feed<Contact> f = cr.Get<Contact>(query);

            foreach (Contact t in f.Entries)
            {
                int idpos = t.Id.ToString().LastIndexOf("/") + 1;
                string contactid = t.Id.ToString().Substring(idpos);
                con.WriteLine(contactid + "|" + t.Updated + "|" + t.ToString());
            }
            con.Close();
        }
    }
}

0 Answers0