Post picture to facebook page album

廉价感情. 提交于 2019-12-25 07:24:17

问题


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

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?


回答1:


One need the extended permissions "manage_pages" and "publish_actions" to post a picture to a facebook album!



来源:https://stackoverflow.com/questions/23758163/post-picture-to-facebook-page-album

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!