.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Import Gmail Contact and Email Address in asp.net c#

Posted By:Brijesh Kumar       Posted Date: March 15, 2011    Points: 40    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

This article refer you for import Gmail Contact and Email Address in asp.net c#.

1)  add these dll in you application:- 
Right click on Solution Explorer and add reference option.

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

2) Drag a button which name is "ImportContact" and a TextBox for enter the email id and drag another TextBox for enter the password.  and a listBox for show the contact and email address.

3)  Write this code to Button_Click:--

     //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 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);


Further Readings:

Author: foram         Company URL: http://www.dotnetspark.com
Posted Date: August 29, 2012

Thank Brijesh Kumar,

Nice one.

do you know how to share contacts to the out side domain using API?

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend