Import hotmail, outlook contacts with Javascript using Windows Live Contact API

In this tutorial I will show you a practical example of web development: how to import hotmail, outlook, live contacts to your web project, using a client-side method (javascript).

The response data will come in javascript, but you can easily pass it to php with an ajax function.

Note: If you don’t have a  live.com account (oulook, hotmail, live), you can create it here : https://www.live.com


Import contacts windows live api

View demoDemo importing contacts with Windows Live Contact API

Step 1

Create a Live.com application in “Microsoft account Developer Center” for obtaining your Client ID and Client Secret.

 

Create application Live API

 

 

  • Complete your basic information: application name, application logo, urls, etc

Live api complete basic info

 

 

  • Go to “API Settings” from the left menu.
  • – For “Mobile and desktop client app” select NO
    – “Target domain” – leave blank
    – “Restrict JWT issuing” select NO
    – for “Root domain” enter your application url: http://www.example.com
    – for “Redirect URLs” enter the url that live.com API will use to redirect your response data. For example, after a user will accept giving credentials to your application, he will receive an automatically a response to http://www.example.com

 

Live api settings

 

 

  • go to “App settings” from the left menu, to view your API credentials, Client ID and Client Secret

Live api app settings

 

Step 2

Code example

  • Reference the API, using a web-based version of the wl.js in your code

More details here: https://msdn.microsoft.com/en-us/library/hh826538.aspx

 

  • Initialize the Live SDK JavaScript library.

More details here: https://msdn.microsoft.com/en-us/library/office/hh550844.aspx

 

  • Create a button to fire the import contacts

 

  • Create a click function to the button, to import contacts using WL.Login

 

  •  when the user will click on that link he will be asked to allow permissions that you import outlook or hotmail contacts for your application

Live.com credentials request

Any question about Windows Live Contact API ?

If you still have problems importing your hotmail or outlook contact to your web application don’t hesitate to post your question below.

How to import Hotmail, Outlook contacts with Javascript using Windows Live Contact API http://bit.ly/1FvJeeg

Posted by Design19 on Thursday, June 4, 2015

Bogdan Rusu

Working in development for more then 10 years, Bogdan Rusu is the CTO of Design19 web agency. Highly skilled in PHP development and usage of CMS like Wordpress, Magento, Zend framework, but also custom built platforms based on PHP, Bogdan has driven the team to a higher level of proficiency in development.

15 Comments

Ashwani

-June 24, 2015 , 11:24 am

It doesn’t ask for login again even after i logged off from my outlook account.Is their a way to remove that session token n ask for another one on each request

    -June 30, 2015 , 2:15 pm

    In your account settings, you can manage permissions for each application. So if you delete credentials for an application, the application will ask again for access.

    Steps:
    1. Login into your live.com account
    2. Go to “Account settings” by clicking your name in the right top corner
    3. Go to “Security & privacy” tab
    4. In the section called “Apps & services” click on “Manage permissions” link.

    Direct link that should work:
    https://account.live.com/consent/Manage?mkt=en-US

adam

-August 5, 2015 , 8:55 pm

1-href of button # is not valid to fire the button to the path
2-following error is coming:
We’re unable to complete your request
Microsoft account is experiencing technical problems. Please try again later.

    Maxime

    -August 21, 2015 , 10:58 am

    I have the same problem…

      Gabriel

      -September 13, 2015 , 2:26 am

      Could you solve it?

      The same problem for me… but just chek in the popup URL, where’s the real error and it says :

      “The client does not exist. If you are the application developer configure a new application through the application management site at https://manage.dev.live.com/”

ankesh

-August 27, 2015 , 12:43 pm

Login window in another language. i want in English or Spanish. Currently show as snap shot:
http://prntscr.com/89fa7v

Gabriel

-September 6, 2015 , 6:47 am

Hey Bogdan, very good post.

Now, I would like to know why while I was developing my app suddenly I started to receive this message:

“The client does not exist. If you are the application developer configure a new application through the application management site at https://manage.dev.live.com/

But the app really exists, and also, when I create a new app it doesn’t works.

Maybe it’s because I’m not using https? I dont know what to think…

Could you help me?

Thanks

Megan

-September 17, 2015 , 12:43 pm

I have an issue with the live account login popup. The popup is not closed after the authentication and the popup window is redirected to the given URL. This works locally. But not working in the real domain.

    saiprasaad``

    -October 19, 2015 , 12:00 pm

    yes getting me also same problem…

Kishan

-November 26, 2015 , 9:07 am

Hello Bogdan your post is nice,

I have issue for contact email return only manually added contact, not all like gmail, linkedin and yahoo import contact.

Currently my hotmail account 30 contact, 2 manually added contact.

When i this process return only 2 contact, how to get all contact list?

Ulysses Alves

-February 1, 2016 , 2:18 pm

To which URL should I redirect the user after Windows Live have returned me the access_token?

snoman

-March 15, 2016 , 12:14 pm

Hello Bogdan Rusu,

I am thankful for this wonderful post .it helped me to import gmail contacts as well as hotmail contacts .

Regards

snoman

-March 15, 2016 , 3:01 pm

Hello sir,

I am getting my hotmail contacts again and again even I am not logged in.

thanks

Vijay

-May 8, 2016 , 5:46 am

I have the dynamic url, how do i use that as a redirect url

Gibran

-July 18, 2016 , 6:37 pm

Hi, Can you give us a example of the callback url, i cant use some url to redirect…

Please.

Leave a comment

Your email address will not be published. Required fields are marked *

  • All fields marked with * are mandatory