简体   繁体   中英

Post picture to facebook page album

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?

一个人需要扩展的权限“ manage_pages”和“ publish_actions”才能将图片发布到Facebook相册!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM