Search code examples
c#liveconnectlive-connect-sdk

Getting data from MS Live Calendar


currently I working on a portal project for getting calendar data from several websites (google, yahoo, live/hotmail). the problem is our application require a service that getting calendar data from those websites. my team already get rid the google and yahoo calendar, but now we having problem with live calendar.

so far here is what we already tried and failed:

  1. Grabbing data using HTTP Request seems impossible because the http://login.live.com totally secured using javascript. we spent 3 days to understand the JS to login but seems microsoft far better than us :)
  2. Searched through the net about LIVE CONNECT API, but now way to dynamically login (by providing username/password) to MS Live. We can't use the Live Login Button because our process done one service layer. (or perhap i miss something?)

is there any chance for me to complete this task?

any help, clue, trick will highly appreciate, thanks

NOTE: our application clients is in a small network and they agree if we managed their LIVE/YAHOO/GOOGLE account.


Solution

  • The answer is NO!, you can't get calendar/events from MS LIVE by providing Email/Password because MS LIVE using OAUTH.

    the best way you can do is, from your client application you show up the live OAUTH login then get the authentication tokken from there. then pass the authentication token to the server side. to get the calendar or events you require.

    here is the step:

    Get your application client id

    go to: https://manage.dev.live.com/Applications/Index

    Create login form

    on your client side application you create a login form by showing an browser control the url is:

    https://oauth.live.com/authorize?response_type=token&client_id=YOUR_APP_CLIENTID&scope=SCOPE&locale=en&redirect_uri=https://oauth.live.com/desktop&auth_redirect=true&wa=wsignin1.0

    • YOUR_APP_CLIENTID: the client id you get from the registration on the first step.
    • SCOPE: should be wl.calendars+wl.basic see more on documentation

    then after user allow the authentication, the browser will redirected to:

    https://oauth.live.com/desktop#access_token=ACCESS_TOKEN
       &token_type=TOKEN_TYPE&expire=EXPIRE
    

    there you can extract the ACCESS_TOKEN from there.

    Grab The Calendar/Event

    so now your client app already have ACCESS_TOKEN then pass this to your service to get the calendar (remember there are a time out for the ACCESS_TOKEN). Your service then should do the REST call to:

    https://apis.live.net/v5.0/me/calendars?access_token=ACCESS_TOKEN
    

    or

    https://apis.live.net/v5.0/me/events?start_time=2012-10-01T00:00:00Z
         &end_time=2012-10-03T00:00:00Z&access_token=ACCESS_TOKEN
    

    for more info refer to: http://msdn.microsoft.com/en-us/library/live/hh826523.aspx

    Good Luck