0

I am trying to build a WPF C# application which requires shared data of a friend of my application user. I have tried using this query https://graph.facebook.com/[User_Id]/?fields=photos. But it do not return the array of object as mentioned in the Facebook Graph API. Although the query https://graph.facebook.com/me/?fields=photos does return pictures for the user.

I am able to retrieve the friend's cover photo by https://graph.facebook.com/[User_Id]/?fields=cover but not the photos, albums, events e.t.c . I can see that they are listed under Connection. Could anybody help ?

4

1 回答 1

0

要访问朋友数据,您必须请求适当的权限。封面照片是公开的,这就是您能够获取它的原因。

朋友的照片和相册:friends_photos
朋友的活动:friends_events

Graph API 调用接收朋友的照片:

https://graph.facebook.com/User_ID/photos?access_token=your_access_token

当您使用 C# 进行开发时,您可能会对原生Facebook C# SDK感兴趣。

[编辑]

通过 C# SDK 获取朋友的照片和事件:

        var fb = new FacebookClient(Session["AccessToken"].ToString());

        var parameters = new Dictionary<string, object>();

        dynamic res = fb.Get("/User_ID?fields=photos,events");

        var photoID = res.photos.data[0].id;
于 2013-04-30T09:06:12.550 回答