How do I check if .Post has send successfully in Facebook C# sdk?

我的梦境 提交于 2019-12-18 09:28:08

问题


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);

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 version: v4.0.30319

Facebook Assembly version: 5.2.1.0

Thanks in advance.


回答1:


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"
    }
  ]
}


来源:https://stackoverflow.com/questions/8057517/how-do-i-check-if-post-has-send-successfully-in-facebook-c-sharp-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!