如何在不使用FQL-.NET的情况下获得post_id的整个帖子内容

本文关键字:id post 情况下 NET FQL- | 更新日期: 2023-09-27 18:09:12

我搜索了很多这个问题的答案,但没有找到任何有用的资源。我正在墙上张贴">https://www.facebook.com/dialog/feed?app_id={0}&display=page&canvas=1&redirect_uri={1}",效果很好,我在墙上发帖,作为回应,我在*redirect_uri*的查询字符串中得到了post_id(我用对话框发帖(。现在我无法做到的..是用facebook图表获取完整的帖子信息,而不使用FQL,我发现了很多如何用FQL Select获取的例子。。但我真的想通过Graph调用来实现这一点。我在.net上做了所有这些,我在脸书上尝试了grapkexplorer:这是确切的网址:http://developers.facebook.com/tools/explorer/266888499999433/?method=GET&路径=100002843173627_116703548434417。使用httpGET方法并使用access_token,我得到了我想要的答案,但从我的代码中这样做并没有成功。如果我执行GEThttp://graph.facebook.com/POST_ID我得到的答案是字符串false。。。如果我加上?access_token=MY_ACCESSTOKEN在querystring中,我得到错误400错误请求。我有一个用这种方法上课的课:

 public Facebook.JSONObject GetPostInfo(string postID)
    {
        //"&access_token=" + this.Token
        string url = "http://graph.facebook.com/" + postID ;
        string json = this.WebRequest(MyFacebookAPI.oAuthFacebook.Method.GET, url ,String.Empty);
        return Facebook.JSONObject.CreateFromString(json);
    } 

谢谢。

如何在不使用FQL-.NET的情况下获得post_id的整个帖子内容

好的。。我终于找到了解决方案:

if (CanvasAuthorizer.Authorize())
        {
            var fb = new FacebookWebClient();
            dynamic parameters = new ExpandoObject();
            parameters.message = txtMessage.Text;
            try
            {
                dynamic id = fb.Post("me/feed", parameters);
                lblPostMessageResult.Text = "Message posted successfully";
                txtMessage.Text = string.Empty;
                //get post id
                IDictionary<string, object> data = new Dictionary<string, object>();
                data.Add("access_token", CanvasAuthorizer.FacebookWebRequest.AccessToken);
                dynamic thePost = fb.Get(String.Format("{0}", id.id), data);
                string post = String.Format("Post:{0} From: {1} Message: {2}", thePost.id, thePost.from.name, thePost.message);
                lblPostMessageResult.Text = Environment.NewLine + post;
            }
            catch (FacebookApiException ex)
            {
                lblPostMessageResult.Text = ex.Message;
            }
        }

其中第一部分以"消息"作为帖子第二部分是我们从帖子中得到的id。

您需要具有扩展权限:publish_stream,read_stream才能工作+将access_token作为参数添加到Get方法中。我希望我的帖子能帮助一些有困难的人把它做好。