开发者

Posting to a Facebook Page using the Graph API - returns ID but doesn't appear

I'm trying to use the Facebook C# SDK to post to a Facebook page stream, but I'm failing miserably. This is what my code looks like:

开发者_Go百科var app = new Facebook.FacebookApp(_accessToken);
var parameters = new Dictionary<string, object>
     {
         { "message" ,  promotionInfo.TagLine },
         { "name" ,  promotionInfo.Title },
         { "description" ,  promotionInfo.Description },
         { "picture" ,  promotionInfo.ImageUrl.ToString() },
         { "caption" ,  promotionInfo.TargetUrl.Host },
         { "link" ,  promotionInfo.TargetUrl.ToString() },
         { "type" , "link" }
     };
var response = app.Post(_targetId + "/feed", parameters);

I've checked and I can see the request in Fiddler go through to Facebook, and I get an ID back - however, when I try and view that ID at http://graph.facebook.com/[parentid]_[postid]

I just get a page with "false" on it, and the post doesn't appear on the Facebook page itself either. If I just enter a random postid that doesn't exist, I get "Some of the aliases you requested do not exist" instead.

The accessToken is authorised to use publish_stream and offline access (generated using this url)

Any ideas what could be going wrong? Thanks

Update I should add, this works fine if I change the _targetId to "me" (ie posting directly to my own profile page)


I found the solution here: Which Facebook permissions allow for posting to a page wall (not profile wall)? which did the trick


This is just an idea, but try it after obtaining the read_stream extended permission.

I know from experience that you can use the ID returned to delete the post, but without read_stream I don't think you can retrieve it (and more interesting stuff like the comments)


To post to a Facebook page, You need to request manage_pages permission. also you have to use the PAGE access_token not User access_token.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜