If you have not noticed before, it's possible to maintain the contact info, email addresses, phone numbers etc. of all your contact using your Google Account. Once you login to your GMail account, in the left side menu click Contacts. You can see all your contacts.
Using Google Contacts API, you can retrieve data of all your contacts email addresses. I have developed a small application using which you can retrive all your contacts email addresses and phone numbers.
The following is the code snippet that retrives the atom feed of all the contacts.
//Get the user feed. max-results by default is 25, lets keep 10000.
HttpWebRequest feedReq = (HttpWebRequest)WebRequest.Create("http://www.google.com/m8/feeds/contacts/" + txtemail.Text + "/full?max-results=10000");
feedReq.Method = "GET";
feedReq.ContentType = "application/x-www-form-urlencoded";
//use the already obtained AuthToken
feedReq.Headers["Authorization"] = "GoogleLogin auth=" + AuthToken;
HttpWebResponse response = (HttpWebResponse)feedReq.GetResponse();
StreamReader responseStream = new StreamReader(response.GetResponseStream());
string resp = responseStream.ReadToEnd();
Click here to download the executable. Running this application requires .NET Framework 3.5 installed on the machine.
Click here to download the source code. This project is created in VS2008 in C#.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment