如何在c#.net或java脚本中从Facebook获取朋友的朋友列表。 我可以用这种方法获得好友列表: -
string data = FaceBookConnect.Fetch(code, "me/friends");
但我不知道如何取朋友的朋友。我也得到了我朋友的Facebook id 。有没有办法用他的Facebook id 取我朋友的朋友?
答案 0 :(得分:1)
string myAccessToken = "something";
FacebookClient client = new FacebookClient(myAccessToken);
var friendListData = client.Get("/me/friends");
JObject friendListJson = JObject.Parse(friendListData);
ArrayList<FbUser> fbUsers = New ArrayList<FbUser>();
foreach (var friend in friendListJson["data"].Children())
{
FbUser fbUser = new FbUser();
fbUser.Id = friend["id"].ToString().Replace("\"", "");
fbUser.Name = friend["name"].ToString().Replace("\"", "");
fbUsers.add(fbUser);
}
facebook用户类
Class FbUser {
String Id { set; get; }
String Name { set; get; }
}
Facebook SDK C# - get friends list
编辑:您无法与朋友交朋友:
Get the Friends of my friend using the Graph API
{
"error": {
"type": "Exception",
"message": "(#604) Can't lookup all friends of <UID>. Can only lookup for the logged in user (<MY_UID>), or friends of the logged in user with the appropriate permission"
}
}