9

window live api

I can get user infomation, contacts, friends through the windows live api correctly.

but when i request for the user profile picture according to the following note:

Note To redirect a GET call to the URL of a user's picture, you can call /me/picture or /USER_ID/picture.

https://apis.live.net/v5.0/me/picture?access_token=MY_ACCESS_TOKEN

It responses null, in fact i have set a profile picture for window live.

it is very strange that I can get all the information except user picture, but when I use the windows Interactive SDK for user picture, it response me the right picture url.

what is the problem?

koogua
  • 254
  • 5
  • 18
  • I was having the same issue but this works for me. string.Format("https://apis.live.net/v5.0/me/picture?access_token={0}", externalIdentity.AccessToken); Maybe your access token is bad? – Bobby Cannon Mar 16 '12 at 17:07
  • @BobbyCannon I can get all info except user picture, so my access token is no problem. – koogua Mar 17 '12 at 01:27

2 Answers2

8

Here is what I do. I did edit this code on the fly so I hope the syntax is correct.

var uri = "https://apis.live.net/v5.0/me?access_token=" + accessToken;
var profile = JObject.Parse(new WebClient().DownloadString(uri));
var pictureUrl = string.Format("https://apis.live.net/v5.0/{0}/picture", profile["id"]);
Bobby Cannon
  • 6,665
  • 8
  • 33
  • 46
  • thanks! That URL still works today, using it for my oAuth Live users – Jakub Jan 20 '14 at 07:24
  • 1
    This works. But how is it that it's not documented anywhere? Also you won't get the picture as part of any other object, you have to request it separately. – GetFree Dec 22 '14 at 08:42
  • 1
    This no longer works. An error message is returned: `"This API is no longer supported. Please see https://aka.ms/livesdkmigration for information about migrating your application to Microsoft Graph."` – Nathan Osman Apr 28 '19 at 01:38
2

Maybe late... but still can be useful to someone else... You don't need the access token if you have the Live user id. Try this:

https://apis.live.net/v5.0/USER_ID/picture?type=large

Of course, you must replace the USER_ID with the one you trying to get the picture... then you can add the preferred size : small (to get a 96 × 96-pixel picture), medium (180 × 180), or large (360 × 360)

Chris L.
  • 25
  • 3