【问题标题】:Access facebook friendlist from Asp.net C# using graph API使用图形 API 从 Asp.net C# 访问 facebook 好友列表
【发布时间】:2019-04-24 12:58:19
【问题描述】:

用户好友列表不返回仅包含好友总数的数据摘要。我正在开发一个 Web 应用程序,该应用程序将获取登录的用户 Facebook 好友列表,然后使用他们的生日在他们的个人资料中发布生日消息。

有没有办法可以邀请 Facebook 好友,然后访问用户好友列表,因为它是一个 Web 应用程序。

enter code here
private List<Person> GetPersonFriendList(string access_token,string id)
    {
        List<Person> friendList = new List<Person>();
        string url;
        #region JSON.Net Friends

        //Friends URL
        url = "https://graph.facebook.com/v3.2/" + id + "/taggable_friends?access_token=" + access_token;


        JObject myFriends = JObject.Parse(requestFBData(url));

        //string id = "";
        //string name = "";

        //Loop through the returned friends
       foreach (var i in myFriends["data"].Children())
       {
         Person friend = new Person();
         friend.id = i["id"].ToString().Replace("\"", "");
        friend.name = i["name"].ToString().Replace("\"", "");
       friendList.Add(friend);
        }

        return  friendList;

        #endregion


    }

私有静态字符串 GetFacebookUserJSON(string access_token) { string url = string.Format("https://graph.facebook.com/me?access_token={0}&fields=email,name,first_name,last_name,link", access_token);

        WebClient wc = new WebClient();
        Stream data = wc.OpenRead(url);
        StreamReader reader = new StreamReader(data);
        string s = reader.ReadToEnd();
        data.Close();
        reader.Close();

        return s;
    }

【问题讨论】:

  • “然后使用他们的生日在他们的个人资料中发布生日消息” - 这也不再可能了。你甚至不能再通过 API 发布到用户自己的私人时间线,而且很长时间以来都无法发布到其他人的时间线。另外,您不应该创建仅复制 Facebook 功能的应用程序......生日提醒以及“今天是 xy 的生日,在他们的时间线上发布”是他们已经提供的功能。忘掉这个应用概念吧,一开始就很糟糕。

标签: c# facebook-graph-api facebook-friends


【解决方案1】:

taggable_friends 已弃用:https://developers.facebook.com/docs/graph-api/reference/user/taggable_friends/

此边缘已于 2018 年 4 月 4 日弃用,现在返回一个空数据集。

无法再访问整个好友列表,您只能通过/me/friends获取也授权您的应用的用户列表。


...使用他们的生日在他们的个人资料中发布生日消息

朋友需要使用user_birthday 权限授权您的应用程序。经验法则:未经明确授权/许可,任何用户都不会提供任何数据。

此外,在很长一段时间内都无法在其他用户的墙上发帖,这将是垃圾邮件 - 无论如何,您都不能自动发布或预填。最后但同样重要的是,您甚至不能再在自己的墙上发帖,因为 publish_actions 也已被弃用。

【讨论】:

  • 感谢您的回复。这意味着无法构建这样的应用程序,它可以自动在您的朋友墙上发布以祝他/她生日快乐..
  • 当然不是,那将是纯粹的垃圾邮件...Facebook上的用户消息/帖子永远不应该自动化。
猜你喜欢
  • 2013-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多