开发者

Why do photos posted to Page Albums only appear on the wall and not in the album

I am posting pictures from a facebook application to a facebook fan page album using the graph API like so:

 protected void PublishToPublicGallery(string accessToken, string filename, long albumId, string imagename)
{

    var facebookClient = new FacebookClient(accessToken);
    var mediaObject = new FacebookMediaObject
    {
        FileName = filename,
        ContentType = "image/jpeg"
    };
    var fileBytes = System.IO.File.ReadAllBytes(filename);
    mediaObject.SetValue(fileBytes);

    IDictionary<string, object> upload = new Dictionary<string, object>();
    upload.Add("name", imagename);
    upload.Add("source", mediaObject);
    var result = facebookClient.Post("/" + albumId + "/photos", upload) as JsonObject;    
}

the problem is that it is only posting the image into the wall photos at the top of the wall tab, and this is apparently an album called {fanpagename} photos. I hav开发者_运维问答e previously created an album and am using this album's id to post the image to.

Can anyone help?

Many thanks.


You need to find the "Wall photos" Object_ID (not aid) from the page Albums, and use that ID to post your picture.

fb.Post("/" + Album_Object_ID + "/photos", parameters);

here's the complete function you need to find the "wall photos" ObjectID and post to the album : from my blog http://www.codicode.com/art/graph_api_post_pictures_to_a_fac.aspx

hope this helps.


You should use "object_id" of the album and not albumid ("aid"), they are different. As far as I understand you're uploading using graph API, so you need to use object_id, object_id you can get having albumid from the album using graph API or FQL.

Also make sure you use albumid as string and not long.

hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜