Reputation: 11
I'm using Facebook C# SDK to publish to a user's wall from an application running in Facebook. Everything works fine (the app has correct permissions to do so) and in fact, the post is sent to the user's wall... what is weird is that the information I'm asking to publish is not exectly what is finally published. My code:
Dim facebook = New FacebookWebClient(fbWebContext)
Dim args As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
args("picture") = "http://www.xxx.com/uploads/yyy.jpg"
args("link") = "https://www.facebook.com/zzz?sk=app_12532830&app_data=10000"
args("name") = "My name"
args("caption") = "My caption"
args("description") = "My description"
args("message") = "My message"
facebook.Post("https://graph.facebook.com/12345/feed", args)
This code works perfectly and gives no error, and a post is correctly generated in the user (in this sample, with ID 12345) wall, BUT... looking at the post in the user's wall, I get:
1. The message is OK
2. The picture is OK
3. The link is NOT OK: I get "https://www.facebook.com/zzz?sk=app_12532830" without the "app_data" parameter!
4. The name is NOT OK: instead of getting "My name", I get "My name | [App Name]" (where [App Name] is the name of the application)
5. Caption is NOT OK: this one simply doesn't appear.
6. The description is OK
Weird!
Now... I have tried doing exactly the same but from the "Graph API Explorer" under the tools for developers in Facebook, specifying all the fields and the same values... and then everything works exactly as expected... Can anybody help me? Does anybody have any clue?
Thank you in advance!
Upvotes: 1
Views: 1044
Reputation: 570
Pete every thing that you said above is working well when i tested. The only one exception was the picture that you tried to add , It is being rejected by saying that "It is a Blocked Content". I'm Using Facebook C# SDK version v4.0.30319. The full code is given below.
var client = new Facebook.FacebookClient(this.UserToken);
dynamic parameters = new ExpandoObject();
parameters.message = "My message";
//parameters.picture = "http://www.xxx.com/uploads/yyy.jpg";
parameters.picture = "http://www.bhaam.org.uk/images/index/den_building.jpg";
parameters.link = "https://www.facebook.com/zzz?sk=app_12532830&app_data=10000";
parameters.name = "My name";
parameters.caption = "My caption";
parameters.description = "My description";
parameters.privacy = new
{
value = "SELF", //value = "ALL_FRIENDS", reference (http://developers.facebook.com/docs/reference/rest/photos.createAlbum/)
};
result = client.Post("me/feed", parameters);
status = true;
Upvotes: 1