简体   繁体   English

如何使用C#Facebook SDK 6.0.10.0在用户墙上发布

[英]How to publish on user's wall with C# Facebook SDK 6.0.10.0

It's hard to find documentation for the newest SDK. 很难找到最新SDK的文档。 I have an app that users signed in agreeing to giving permission for the app to post on their wall. 我有一个用户登录的应用程序,同意授予该应用程序在其墙上发布的权限。

Now I have the app's access token and I'd like to post and entry on the user's wall. 现在我有了应用程序的访问令牌,我想在用户的墙上张贴和输入。 Seems like a simple operation but I can't find any examples. 看起来像一个简单的操作,但我找不到任何示例。

You could use the FaceBook C# SDK . 您可以使用FaceBook C#SDK Here's an article which illustrates how you could post on a user's wall: 是一篇说明您如何张贴在用户墙上的文章:

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
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM