Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...