Facebook C# SDK Sample to Post To Group Wall
Please give a sample of how to post to a group wall using the C# Facebook SDK found at this location https://github.com/facebook-csharp-sdk/facebook-csharp-sdk . Below is just a few lines of relevant code. An fb client is created, parameters filled in (not shown), and a fb.post call is made. For my attempt to post to a group wall, all I did was change the "me/feed" to "groupId/feed". I could probably figure out what is wrong but the Facebook error provides no information. The error returned is "(OAuthException) An unexpected error has occurred. Please retry your request later."
var fb = new FacebookWebClient();
Original SDK Sample Code is: dynamic id = fb.Post("me/feed", parameters);
Attempt to Post to Group is: dynamic id = fb.Post("328271290556233/feed", parameters);
Unfortunately I have not been unable to find an example using the SDK referenced above.
Thank you for any help.
After trying multiple attempts, I figured out the problem by trying to post a message to my group using the Facebook Explorer app at http://developers.facebook.com/tools/explorer . It did post and I realized I had granted the application all rights. I then removed all rights and added back one by one. Here is what is interesting, if you are missing the publish_stream
right, then a post attempt results in a useful error message stating the application does not have the right to post. If your application has publish_stream
but not user_groups
, then you get the unknown error. So, to fix my problem all I had to do was have my application ask for the user_groups
right. The exact rights I use are user_about_me,user_groups,publish_stream,manage_pages
. I hate I missed something so obvious but a helpful error message would have been nice. To post to a group using the SDK just replace "me" with the group id. That is it.