将图片发布到Facebook页面相册

时间:2014-05-20 11:09:59

标签: c# facebook facebook-graph-api facebook-c#-sdk

我有一个以用户身份管理的Facebook页面。这个facebook用户通过c#facebook sdk验证成功。发布到页面的照片标签适合我:

 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时,过帐不起作用。

我做了一些研究,并提到我需要页面访问令牌。我试着这样做:

 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;

但respsonse不给我用户页面的帐户。我是否需要任何特定权限或我做错了什么?

1 个答案:

答案 0 :(得分:0)

需要扩展权限&#34; manage_pages&#34;和&#34; publish_actions&#34;将照片发布到脸谱相册!