czwartek, 17 listopada 2011

Import Contacts From Gmail, Yahoo, Hotmail Asp.Net

Import contacts from Gmail, Yahoo, Hotmail.

I spend a few days to configure how to import contacts in my asp.net application. You can find a lot of information in
internet, but it very hard to find something really handy. I won't describe step by step how you can do that. You can
download project and check it yourself. To make it works in Visual Studio you need to add host
entry "127.0.0.1 test.ie" to C:\Windows\System32\drivers\etc\hosts (You need to have port 80 free on your local IIS).
When you start the project change url from  localhost to test.ie and it should work.

All needed dlls should be in project, but if somebody want to create project from scratch I will describe few main steps:

Yahoo

1. Register your application to get consumer key and consumer secret
    http://developer.yahoo.com/bbauth/appreg.html
    Don't forgot to change prermision to read Contacts
2. Download and extract DotNetOpenAuth-3.4.7.1112 from http://www.dotnetopenauth.net
3. Add DotNetOpenAuth.dll to project references
4. Download file OAuthBase.cs from http://oauth.googlecode.com/svn/code/csharp/ and add to project

Hotmail

1. Register your application to get Client ID and Client Secret
    http://go.microsoft.com/fwlink/?LinkID=144070
2. Download and install Windows Live ID Delegated Authentication SDK 1.2
    http://www.microsoft.com/download/en/details.aspx?id=2860
3. Add file windowsLiveLogin.cs to Project. It should be in C:\Program Files\Windows Live ID\DelAuth\App_Code

Gmail

1. Register your application to get Client ID and Client Secret
https://code.google.com/apis/console
2. Download Google_Data_API_Setup_1.9.0.0.msi from http://code.google.com/p/google-gdata/downloads/list
3. Add references Google.GData.Client, Google.GData.Contacts, Google.GData.Extensions to Project. Files should be in folder C:\Program Files\Google\Google Data API SDK\Redist

If this post help you , you can buy me a beer.




3 komentarze:

  1. Hi! This is indeed very great work. I am trying to re-write this in asp.net mvc 4. If i succeed I will submit it to you so you could upload it. Thank you so much!

    OdpowiedzUsuń
  2. What I do not understand is, after the re-direct from the Yahoo or Google authenticated, nothing happens. At which point will I intercept and get the contacts?

    OdpowiedzUsuń
  3. hey finally i can reach you this code is really works and save my life :D but...

    i cannot give this return value shit and

    i cannot get hotmail contacts how can i get them?

    OdpowiedzUsuń