1

我正在使用 Facebook C# SDK 从 Facebook 中运行的应用程序发布到用户的墙上。一切正常(应用程序具有正确的权限),事实上,帖子被发送到用户的墙上......奇怪的是我要求发布的信息并不完全是最终发布的信息。我的代码:

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)

此代码完美运行并且没有错误,并且在用户墙上正确生成了一个帖子(在此示例中,ID 为 12345),但是...查看用户墙上的帖子,我得到:

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

诡异的!

现在......我已经尝试做完全相同的事情,但是从 Facebook 开发人员工具下的“Graph API Explorer”,指定所有字段和相同的值......然后一切都按预期工作......任何人都可以帮我?有人有任何线索吗?

先感谢您!

4

1 回答 1

1

皮特你上面说的每件事在我测试时都运行良好。唯一的一个例外是您尝试添加的图片,它被拒绝说“这是一个被阻止的内容”。我正在使用 Facebook C# SDK 版本 v4.0.30319。完整的代码如下。

            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;
于 2012-07-13T12:21:20.893 回答