2
我需要發佈一個帖子我的應用程序的個人資料頁上的應用程序的應用程序並不像這裏的用戶是代碼:Facebook應用程序頁面上發佈爲使用Facebook的C#SDK
var fb = new FacebookOAuthClient(FacebookApplication.Current);
dynamic resultt = fb.GetApplicationAccessToken();
var appAccessToken = resultt.access_token;
dynamic messagePost = new ExpandoObject();
messagePost.access_token = appAccessToken;
messagePost.picture = "";
messagePost.link = "";
messagePost.name = "[SOME_NAME]";
messagePost.caption = "{*actor*} " + "[YOUR_MESSAGE]"; //<---{*actor*} is the user (i.e.: Aaron)
messagePost.description = "[SOME_DESCRIPTION]";
FacebookClient appp = new FacebookClient(appAccessToken);
try
{
var result = appp.Post("/" + appId + "/feed", messagePost);
}
catch (FacebookOAuthException ex)
{
//handle something
}
catch (FacebookApiException ex)
{
//handle something else
}
or
var fb = new FacebookClient(appId, FacebookApplication.Current.AppSecret);
var appAccessToken = fb.AccessToken;