简体   繁体   English

获取用户usinf Facebook C#SDK的朋友列表

[英]Get list of friends for user usinf facebook c# sdk

I my application I want to get list of user friends. 我想在我的应用程序中获取用户朋友列表。 So am using bellow code. 因此,我在使用波纹管代码。

            dynamic mw2 = client.Get("/me/friends",
                 new
                 {
                     access_token = accessToken
                 });

In response Data array comes as empty & count comes as 304 (which count of my friends). 作为响应,数据数组为空,计数为304(我朋友的计数)。

I have also added permission "user_friends" while taking app permissions from user. 从用户获取应用程序权限时,我还添加了权限“ user_friends”。 But when I referred facebook guid it says that 但是当我提到facebook guid时,它说

"user_friends “user_friends

Provides access the list of friends that also use your app. 提供对也使用您的应用程序的朋友列表的访问。 These friends can be found on the friends edge on the user object. 这些朋友可以在用户对象的朋友边缘找到。

In order for a person to show up in one person's friend list, both people must have decided to share their list of friends with your app and not disabled that permission during login. 为了使一个人出现在一个人的朋友列表中,两个人都必须决定与您的应用共享他们的朋友列表,并且在登录时未禁用该权限。 Also both friends must have been asked for user_friends during the login process." 另外,在登录过程中也必须要求两个朋友都提供user_friends。”

As per this description I will not be able to get all friends list for my app. 按照此说明,我将无法获取我的应用程序的所有好友列表。 Is there any other way to get list of friends ? 还有其他方法可以获取朋友列表吗?

You said it yourself: "As per this description I will not be able to get all friends list for my app". 您自己说:“按照此说明,我将无法获得我的应用程序的所有好友列表”。

/me/friends will return an empty value (with a total count of your friends only) if none of your friends authorized your App. 如果您的朋友均未授权您的应用,则/me/friends将返回一个空值(仅包含您的朋友总数)。 There is no way to get all friends anymore, except for tagging them or for inviting them to a game with canvas implementation. 除了给他们加标签或邀请他们参加使用画布实现的游戏外,再也没有办法吸引所有朋友。

All the information you need can be found in the answer of this thread: Get ALL User Friends Using Facebook Graph API - Android 您可以在该主题的答案中找到所有需要的信息: 使用Facebook Graph API获取所有用户朋友-Android

I did same thing 3-4 months ago: 我在3-4个月前做了同样的事情:

I tried using : 我尝试使用:

 var client = new FacebookClient(accessToken);
 dynamic FrndList = client.Get("/me/friends").ToString();

then you can use : 然后您可以使用:

 foreach (var item in FrndList.data)

to iterate through each friend. 遍历每个朋友。

The permission read_friendlists no longer allows you to read the list of friends in a friendlist, but only lets you access the name of the list. 权限read_friendlists不再允许您读取朋友列表中的朋友列表,而仅允许您访问列表的名称。 This is useful for people building custom audience selectors when posting stories. 这对于在发布故事时构建自定义受众选择器的人很有用。 All friends_* permissions have been removed. 所有friends_ *权限均已删除。

In Graph API v2.0, access to /me/friends is no longer part of the default (public_profile) permissions. 在Graph API v2.0中,对/ me / friends的访问不再是默认(public_profile)权限的一部分。 We now require you to ask for the new permission user_friends. 现在,我们要求您请求新的权限user_friends。 With this permission, /me/friends now returns the person's friends who are also using the app. 有了此许可, / me / friends现在可以返回也在使用该应用程序的用户的朋友。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM