我如何检查是否.POST已经成功地在Facebook的C#SDK送? [英] How do I check if .Post has send successfully in Facebook C# sdk?

查看:194
本文介绍了我如何检查是否.POST已经成功地在Facebook的C#SDK送?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用下面的code发送的消息:

I try send the message using the followingcode:

//... 
FacebookClient fbClient = new FacebookClient(appId, appSecret);
fbClient.AccessToken = "...";
string to = "user id";
dynamic result = fbClient.Post(String.Format("{0}/feed", to), parameters);

但我怎么知道,如果menssage已发送给用户成功?什么是对的情况下成功/错误回报的回报?我没有找到Facebook的SDK,API的文档中的一些细节的C#。

but how I can know if the menssage has send to user successfully? what's the returns on case success/erros? I not found some details in the documentation of facebook-sdk-api for C#.

.NET版本: v4.0.30319

Facebook的大会版本: 5.2.1.0

Facebook Assembly version: 5.2.1.0

在此先感谢。

推荐答案

通过采取基准的 https://developers.facebook.com/docs/reference/rest/stream.publish/  你将不得不为的post_id 结果参数全成呼叫,如果失败,它应该是一些JSON,包括错误信息,例如:

by taking reference https://developers.facebook.com/docs/reference/rest/stream.publish/ you will have post_id for result parameter for successfull call, if fail it should be some json including error message, for example:

{
  "error_code": 200,
  "error_msg": "The user hasn't authorized the application to perform this action",
  "request_args": [
    {
      "key": "method",
      "value": "stream.publish"
    },
    {
      "key": "access_token",
      "value": "AAAC9okD6ZA7ABABhvJOZBQvUE2OsuHLKEkqlvKKkPDNB9kHfF55DqgKF2raHmSaUSgkpvLtgWniM5CFnu5mxaGODLqvwVz9zBNd1Jd6AZDZD"
    },
    {
      "key": "format",
      "value": "json"
    }
  ]
}

这篇关于我如何检查是否.POST已经成功地在Facebook的C#SDK送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆