将图片发布到Facebook页面相册 [英] Post picture to facebook page album
问题描述
我有一个Facebook页面,其中一个用户为管理员.通过c#facebook sdk成功验证了该facebook用户.发布到页面的照片"标签上对我有用:
I have a facebook page with an user as administrator. This facebook user is authenticated successfull via c# facebook sdk. Posting to the photos tab of the page works for me:
FacebookClient fb = new FacebookClient(_accessToken);
fb.AppId = APPID;
fb.AppSecret = SECRETID;
dynamic parameters = new ExpandoObject();
parameters.message = "test1";
var bytes = File.ReadAllBytes(@"C:\temp\excel.jpg");
parameters.source = new FacebookMediaObject
{
ContentType = "image/jpeg",
FileName = Path.GetFileName("ffdsfsa")
}.SetValue(bytes);
var res = fb.Post("/[photosID]/photos", parameters); // changing to albumID does not work
将photosID
更改为相册ID时,将不起作用.
When changing the photosID
to an album ID posting does not work.
我做了一些研究,并提到我需要页面访问令牌.我尝试通过:
I did a little research and it is mentioned that I need the page access token. I try this by:
FacebookClient fb = new FacebookClient(userAccessToken);
fb.AppId = APPID;
fb.AppSecret = SECRETID;
fb.AccessToken = userAccessToken;
Dictionary<string, object> fbParams = new Dictionary<string, object>();
dynamic publishedResponse = fb.Get("/me/accounts", fbParams) as JsonObject;
但是响应没有给我用户页面的帐户.我是否需要任何特定的权限,或者我在做什么错了?
But the respsonse gives me not the accounts of the pages of the user. Do I need any specific permissions for this or what am I doing wrong?
推荐答案
一个需要扩展权限"manage_pages"和"publish_actions"才能将图片发布到Facebook相册!
One need the extended permissions "manage_pages" and "publish_actions" to post a picture to a facebook album!
这篇关于将图片发布到Facebook页面相册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!