Kassem
Kassem

Reputation: 8266

Facebook API: Including an image in the wall post

According to the Facebook Documentation all I have to do is add a "picture" property to the post object... But this is not working, here's my code:

    [CanvasAuthorize(Permissions = "publish_stream,offline_access")]
    public ActionResult Share(string message, string link, string picture, string name)
    {
        var fb = new FacebookWebClient();
        var postArgs = new Dictionary<string, string>();
        postArgs["message"] = message;
        postArgs["link"] = link;
        postArgs["picture"] = picture;
        postArgs["name"] = name;

        fb.Post("/me/feed", postArgs);
        return Json(new {result = "success"}, JsonRequestBehavior.AllowGet);
    }

Upvotes: 1

Views: 6420

Answers (1)

bkaid
bkaid

Reputation: 52073

What value are you sending for picture? It needs to be a full url, eg http://www.example.com/photo.jpg. Also, it needs to be a URL that Facebook servers can access because Facebook will cache the image and then turn your link into their cached image url.

Upvotes: 1

Related Questions