• How to import Gmail contacts in C# application

    by  • April 16, 2014 • Microsoft .NET C# (C-Sharp), Microsoft ASP.NET • 0 Comments

    A good application, for users, is one that minimizes the user efforts when using an application. So most of the social networking and other sites provide the facility for users to send request or invite friends by importing contacts from Gmail, Yahoo, MSN etc. We may need to use user Gmail, Yahoo, MSN contacts for other purposes so we have to import these contacts and use it for our purposes. Recently I was working on an application and I was in need to import user contacts only from Gmail so I have written code for this purpose. I am sharing this code snippet with you.

    You just need to use Google data API in your application to import Gmail contacts. So download Google data API and add references for following DLLs in your application.

    Google.GData.Apps.dll

    Google.GData.Client.dll

    Google.GData.Contacts.dll

    Google.GData.Extensions.dll

    Add a class in your application as below

     

    Namespaces

     

    Now add following code snippet to import Gmail contacts

     

    As you can see we need login information of the user to import contacts of that user. Then we just need to call the GetContact() method of the ContactsRequest object. Well, at the end you can use these contacts for your purpose. I am looping through this contact list which i have imported and just displaying the title and email address of every contact.

    Download complete application code from below link.

    Download256 downloads




    Namecheap.com
    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply