Import Gmail Contacts Using ASP.Net.

Hi Friends,

Today My Post Is Using Dot Net Application We Can Get The Gamil Contacts.


1.Use Need To Get  ” Google.GData.Client.dll” from google.

2.Add Reference In Your Web Application

3.Then Create on Folder Name as App_Name inside that folder create a one class.

4.Inside That Class Right This Code

using Google.GData.Contacts;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.Contacts;

public class Class1
public static DataSet GetGmailContacts(string App_Name,string Uname, string UPassword)
DataSet ds = new DataSet();
DataTable dt = new DataTable();
DataColumn C2 = new DataColumn();
C2.DataType = Type.GetType(“System.String”);
C2.ColumnName = “EmailID”;
RequestSettings rs = new RequestSettings(App_Name,Uname, UPassword);
rs.AutoPaging = true;
ContactsRequest cr = new ContactsRequest(rs);
Feed<Contact> f = cr.GetContacts();
foreach (Contact t in f.Entries)
foreach (EMail email in t.Emails)
DataRow dr1 = dt.NewRow();
dr1[“EmailID”] = email.Address.ToString();
return ds;

5.Now Create Default1.aspx page

create two text box and one button

inside the button click event write this code

//Import This Namespace

using Google.GData.Contacts;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.Contacts;



Session[“username”] = txtUserName.Text;
Session[“password”] = txtPassword.Text;
Session[“App_Name”] = “MyNetwork Web Application!”;


If Your Username ands Password will match This Will redirect to Default2.aspx page,So Create Default2.aspx page in that page load event write this code



string App_Name = Session[“App_Name”].ToString();
string username = Session[“username”].ToString();
string password = Session[“password”].ToString();
//DataSet ds = GContactsImport.GetGmailContacts( username, password);
DataSet ds = Class1.GetGmailContacts(App_Name,username, password);
GridView1.DataSource = ds;



About developersite
I am Dot Net Programmer

One Response to Import Gmail Contacts Using ASP.Net.

  1. Rajesh says:

    thnks a lot ……………..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: