Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
920 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...