Reputation: 21
I'm using Facebook C# SDK to post on fan page wall. (I created FBApp ext...) and using FB connect (Javascript) to user login, with this scope - "publish_actions,manage_pages,publish_stream". after user login i got an access_token to post on the page.
I have a page, and on the page settings "Everyone can add photos and videos to Testpage's timeline" is checked.
I can post message and picture, but when i tried to post a video (Youtube URL), it's appears on section "Recent Posts by Others on Testpage". When the Everyone can add photos and videos to Testpage's timeline" is not checked, I don't see any post.
My Facebook user is admin on the page and I'm login with this user.
Thank's
Upvotes: 1
Views: 3509
Reputation: 21
To do this, you need to get the access token from the user accounts, and not from the FB.Login.
string getPagesTokensUrl = string.Format(@"https://graph.facebook.com/me/accounts?access_token={0}",accessToken);
using (WebClient wc = new WebClient())
{
var pagesTokens = wc.DownloadString(getPagesTokensUrl);
JObject o = JObject.Parse(pagesTokens);
for (int i = 0; i < o["data"].Count(); i++)
{
if (o["data"][i]["id"].ToString() == ConfigurationManager.AppSettings["YOUR PAGE ID"])
{
return o["data"][i]["access_token"].ToString();
}
}
}
Upvotes: 1