Import Gmail contacts in application

Its very simple to import contact from Gmail account. We need add four references in our application. like


Add name space on the top of the page:

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

Code behind code:

   <form id="form1" runat="server">
        <b>Email Address : </b>
        <br />
        <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
        <br />
        <br />
        <b>Password : </b>
        <br />
        <asp:TextBox ID="txtPassword" runat="server" TabIndex="1" TextMode="Password"></asp:TextBox>
        <br />
        <br />
        <asp:Button ID="btnContacts" runat="server" onclick="btnContacts_Click" 
            TabIndex="2" Text="Import Contacts" Width="125px" />
        <br />
        <br />
        <br />
        <b>Contacts:<br />
        <asp:ListBox ID="lstContacts" runat="server" Height="176px" Width="229px">
        <br />
        <br />

C# code:

protected void btnContacts_Click(object sender, EventArgs e)
        //Provide Login Information
        RequestSettings rsLoginInfo = new RequestSettings("", txtEmail.Text, txtPassword.Text);
        rsLoginInfo.AutoPaging = true;
        // Fetch contacts and dislay them in ListBox
        ContactsRequest cRequest = new ContactsRequest(rsLoginInfo);
        Feed<Contact> feedContacts = cRequest.GetContacts();
        foreach (Contact gmailAddresses in feedContacts.Entries)
            Console.WriteLine("\t" + gmailAddresses.Title);
            foreach (EMail emailId in gmailAddresses.Emails)
                Console.WriteLine("\t" + emailId.Address);
                lstContacts.Items.Add(" " + emailId.Address);