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

现在我有了应用程序的访问令牌,我想在用户的墙上张贴和输入。看起来像一个简单的操作,但我找不到任何示例。

最佳答案

您可以使用FaceBook C# SDK。以下是an article,它说明了如何在用户的墙上张贴信息:

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
}

10-04 15:17