简体   繁体   English

从fb读取消息

[英]reading messages from fb

I successfully login to facebook but while trying to read the mailbox I got the following error: {"(OAuthException - #298) (#298) Requires extended permission: read_mailbox"} 我成功登录到Facebook,但是在尝试读取邮箱时,出现以下错误: {"(OAuthException - #298) (#298) Requires extended permission: read_mailbox"}

If I add that scope in the URL; 如果我在URL中添加该范围;

  var destinationUrl =
                    String.Format(
                        "https://www.facebook.com/dialog/oauth?client_id={0}&scope={1}&display=popup&redirect_uri=http://www.facebook.com/connect/login_success.html&response_type=token",
                        AppID, //client_id
                        "user_posts" //scope
                        );

and try to get mails: 并尝试获取邮件:

 private void FaceBookScrapper()
        {
            var client = new FacebookClient(_fbToken);
            var input = new List<FbMesseage>();
            if (client != null)
            {
                dynamic result = client.Get("me/inbox", null);
                foreach (var item in result.inbox.data)
                {
                    if (item.unread > 0 || item.unseen > 0)
                    {
                        foreach (var message in item.comments.data)
                        {
                            input.Add(new FbMesseage
                            {
                                Id = message.id,
                                FromName = message.from.name,
                                FromId = message.from.id,
                                Text = message.message,
                                CreatedDate = message.created_time
                            });
                        }

                        FbMesseageCollectionViewModelIns.LoadData(input);
                    }
                }
            }
        }
    }
}

That permission doesn't exist any more - it has been removed, together with the /user/inbox endpoint. 该权限不再存在-它已与/user/inbox端点一起被删除。

https://developers.facebook.com/docs/apps/changelog#v2_4_deprecations mentions this, and https://developers.facebook.com/docs/graph-api/reference/v2.5/user/inbox as well. https://developers.facebook.com/docs/apps/changelog#v2_4_deprecations提到了这一点, https://developers.facebook.com/docs/graph-api/reference/v2.5/user/inbox也是如此。

Under the latter URL, it says it right on the very top of the page: 在后一个URL下,它在页面的最上方说:

This document refers to a feature that was removed after Graph API v2.4. 本文档引用了在Graph API v2.4之后删除的功能。

There is no way any more to access a user's inbox via API. 无法再通过API访问用户的收件箱。

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

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