Import Google Contacts – ASP.NET
How can we download our google address book to some local DB, file etc? One of the coolest things google has provided for developers is the Google Data API for integration of user and google applications.
And for importing google contacts, firstly we need to download Google Data API and install them to get the required dlls. Then create a web application in Visual Studio, and add those dlls in your bin folder, or add reference of these dlls in your application.
Following dlls are being used for importing address book:
Now place the required textboxes and button to fetch address book (Two textboxes for username and password, one listbox for address book and one button to start fetching).
following is the code snippet for declaring dll classes in your code behind:
following code snippet is to be written behind your button’s click event:
protected void btnAddressBook_Click(object sender, EventArgs e)
RequestSettings requestLoginInfo = new RequestSettings(“”, txtEmail.Text, txtPassword.Text);
rsLoginInfo.AutoPaging = true;
// Fetch addressbook and dislay them in ListBox
ContactsRequest conRequest = new ContactsRequest(requestLoginInfo);
Feed <contact> feedContacts = conRequest.GetContacts();
foreach (Contact addressbook in feedContacts.Entries)
// Adding contact
foreach (EMail emailId in addressbook.Emails)
// Adding Emails for specific contact
lstContacts.Items.Add(” ” + emailId.Address);