Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get profile picture from windows live

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?

like image 773
koogua Avatar asked Nov 29 '11 03:11

koogua


1 Answers

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"]);
like image 105
Bobby Cannon Avatar answered Oct 20 '22 17:10

Bobby Cannon