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.