get profile picture from windows live
Asked Answered
T

2

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?

Tinct answered 29/11, 2011 at 3:37 Comment(2)
I was having the same issue but this works for me. string.Format("apis.live.net/v5.0/me/picture?access_token={0}", externalIdentity.AccessToken); Maybe your access token is bad?Monger
@BobbyCannon I can get all info except user picture, so my access token is no problem.Tinct
M
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"]);
Monger answered 22/8, 2012 at 21:57 Comment(3)
thanks! That URL still works today, using it for my oAuth Live usersHostelry
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.Stone
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."Crural
B
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)

Burl answered 3/4, 2016 at 3:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.