S
S
sermal2013-05-27 10:29:08
Facebook
sermal, 2013-05-27 10:29:08

Post a photo to a Facebook community wall?

You need to post an image on the community wall.
There is such a code

private static void PostToWall(string message, long id, string wallAccessToken, string ImagePath)
{
    var fb = new FacebookClient(wallAccessToken);
    string url = string.Format("{0}/{1}", id, "photos");
    var argList = new Dictionary<string, object>();
    var imgstream = File.OpenRead(ImagePath);

    dynamic res = fb.Post(url, new
    {
      message = Status,
      file = new FacebookMediaStream
      {
        ContentType = "image/jpg",
        FileName = System.IO.Path.GetFileName(ImagePath)
      }.SetValue(imgstream)
    });  
}

id – community id
in the string string url = string.Format("{0}/{1}", id, "photos"):
if "feed" - then fast without image, only text
if "photos" - fast on behalf of user, picture as an attachment
If you post on your page with /me/photos, then everything works as it should.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2013-05-27
@RedOctoberCZ

>> If you post on your page with /me/photos, then everything works as it should.
And if like this: /GROUP_ID/photos

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question