2

很难找到最新 SDK 的文档。我有一个应用程序,用户登录后同意授予该应用程序在他们的墙上发布的权限。

现在我有了应用程序的访问令牌,我想在用户的墙上发布和条目。似乎是一个简单的操作,但我找不到任何示例。

4

1 回答 1

4

您可以使用Facebook C# SDK。这是一篇文章,说明了如何在用户的墙上发帖:

dynamic messagePost = new ExpandoObject();
messagePost.picture = "http://yaplex.com/uploads/yaplex-logo-with-text-small.png";
messagePost.link = "http://yaplex.com/";
messagePost.name = "[name] Facebook name...";

// "{*actor*} " + "posted news..."; //<---{*actor*} is the user (i.e.: Alex)
messagePost.caption = " Facebook caption";
messagePost.description = "[description] Facebook description...";
messagePost.message = "[message] Facebook message...";

string acccessToken = "xxxx5120330xxxx|4xxxxx0c0f95bd3f62dxxxxx.1-10000xx4x73xxxx|2xx5xxx0566xxxx|z2xxxx37dxxxxsdDS23s_Sah34a";
FacebookClient appp = new FacebookClient(acccessToken);
try
{
    var postId = appp.Post("24351740xxxxxx" + "/feed", messagePost);
}
catch (FacebookOAuthException ex)
{
    //handle oauth exception
}
catch (FacebookApiException ex)
{
    //handle facebook exception
}
于 2012-05-22T21:46:03.340 回答