4

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:

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)

James Crowley
  • 3,911
  • 5
  • 36
  • 65
  • i got the same problem,,, it posts on my facebook wall and some of our website's users walls but it fails on others – robert Jul 24 '12 at 05:21

3 Answers3

3

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

Community
  • 1
  • 1
James Crowley
  • 3,911
  • 5
  • 36
  • 65
0

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.

Chtioui Malek
  • 11,197
  • 1
  • 72
  • 69
0

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)

Pat James
  • 4,348
  • 26
  • 39
  • unfortunately that doesn't seem to be it. the strange thing is the same code works fine posting to my own profile page... – James Crowley Feb 03 '11 at 11:16