Bad Banana
Bad Banana

Reputation: 307

How to add post with place (location) to user's wall via graph API?

When I create a post (status update) on my own wall via facebook web site I can specify location. How can I specify location for new post via facebook graph API?

Here is code that I use to post status updates on user's wall.

FacebookClient fbClient = new FacebookClient(accessToken);  
parameters = new Dictionary<string, object> { { "message", "hi! this is my status message" }};
fbClient.Post("me/feed", parameters);

Upvotes: 2

Views: 4151

Answers (2)

Nate Totten
Nate Totten

Reputation: 8932

You can pass in a place object to set the location. This is documented on Facebook's developer docs here: https://developers.facebook.com/docs/reference/api/post/

Here is an example on doing this with the place object using the id and name of the place.

FacebookClient fbClient = new FacebookClient(accessToken);  
parameters = new Dictionary<string, object> { 
    { "message", "hi! this is my status message" },
    { "place", "facebook_id_of_place" }
};
fbClient.Post("me/feed", parameters);

Upvotes: 1

Bad Banana
Bad Banana

Reputation: 307

Here is working example:

var facebookClient = new FacebookClient(attendee.FacebookToken);
var parameters = new Dictionary<string, object>
                                 {
                                     {"message", message},
                                     {"place", placeID}
                                 };
dynamic response = facebookClient.Post("me/feed", parameters);

Upvotes: 1

Related Questions