Reputation: 31
I'm trying to post a comment to a status on Facebook. Basically what I'm doing is something like this:
var parameters = new Dictionary<string, object>(); parameters["message"] = "hello";
fb.Post("/"+id+"/comments", parameters);
Where fb
is a FacebookClient object and id
is the id of the status.
Unfortunately this doesn't post the comment on recent status. For instance, if I type https://graph.facebook.com/"id"/comments
in a web-browser it returns no data if the status is recent, but if the status is old (more than 1 month) it returns the information about the comments on that status.
Is there a way to comment on a status, picture, etc. using this API with C#?
Upvotes: 3
Views: 3613
Reputation: 1
For this, you need to learn about how can you use Graph API and you also need to learn about some parameters like
There are many more but it can be understood by the standard programmatic interfaces. When you use the programming language which you prefer should be based on HTTPS requests. The version of APIs describes that all the requests are firstly in encrypted form and then they are sent via HTTPs requests. To do so, you need to send make a registration for your application even users are not allowed to log in. I hope it would work for you. But apart from it, you need to do more researches.
Upvotes: 0
Reputation: 9
I was having the same issue so I tried few things & this worked for me
var token = "[your access token]";
var fb = new Facebook.FacebookClient(token);
var postId = "173213306032925_74xxxxxxxxxxxxx"; //replace this with your big id which comprises of [userid]_[postid]
var parameters = new Dictionary<string, object>();
parameters.Add("message", "test message");
Console.WriteLine(fb.Post(id+"/comments", parameters).ToString()); // should give new comment's id
Console.WriteLine(fb.Get(postId +"/comments").ToString()); //should give you details
//for deleting
fb.Delete(newly_created_comment_id); //should return true or false
Upvotes: 0
Reputation: 1160
string AccessToken = "...." // User's access token
FacebookClient fb = new FacebookClient(AccessToken);
dynamic parameters = new ExpandoObject();
parameters.message = txtNewComment.Text.Trim();
dynamic result=fb.Post(HiddenMyPostID.Value+"/comments", parameters);
Above is code that i use for posting new comment on any post of facebook. And It's working.
Upvotes: 0
Reputation: 1069
the fb.Post command seems to be correct. I use the same (in vb.net) and it works like expected...
Upvotes: 1