好吧,我只是碰到了這個同樣的事情。出於我的目的,我正在授權應用程序作爲粉絲頁面發佈到FB粉絲頁面。所以我可以讓多個用戶訪問該應用程序,但不能訪問粉絲頁面,以粉絲頁面的形式發佈。它符合我的要求。
無論如何,這裏是我如何使用C#Facebook SDK Beta V5.0.9。 第一步,確保您試圖發佈的用戶帳戶能夠發佈到粉絲頁面,並有權從應用程序中這樣做。
其中大部分類似於VorTechS的帖子,只是稍微澄清一下。
Dictionary<string,string> fbParams = new Dictionary<string,string>();
fbParams["message"] = Title;
fbParams["caption"] = string.Empty;
fbParams["description"] = string.Empty;
fbParams["req_perms"] = "publish_stream";
fbParams["scope"] = "publish_stream";
//Initialize Your Facebook Client in the manner that suits you, I did it by supplying a saved access token from a single users
FacebookWebClient fbClient = new FacebookWebClient(<YOUR_ACCOUNT_ACCESS_TOKEN>);
//Get the listing of accounts associated with the user
dynamic fbAccounts = fbClient.Get("/me/accounts");
//Loop over the accounts looking for the ID that matches your destination ID (Fan Page ID)
foreach (dynamic account in fbAccounts.data) {
if (account.id == <DESTINATION_ID_OF_YOUR_FAN_PAGE>) {
//When you find it, grab the associated access token and put it in the Dictionary to pass in the FB Post, then break out.
fbParams["access_token"] = account.access_token;
break;
}
}
//Then pass your destination ID and target along with FB Post info. You're Done.
dynamic publishedResponse = fbClient.Post("/" + <DESTINATION_ID_OF_YOUR_FAN_PAGE> + "/feed", fbParams);
一個似乎有事件已被回答:) http://stackoverflow.com/questions/4925705/how-to-programmatically-add-an-event-to-a-page-using-graph-api/4926393#4926393 – VorTechS 2011-03-08 15:38:39