Search code examples
facebook-c#-sdkiframe-app

Facebook C# SDK - Posting message to a users wall


Using the latest beta 5.0.9, I am setting the appID and appSecret programatically and performing a post to users wall / feed successfully. This is all good.

However, on Facebook the message that has been posted is always "credited" (i.e. 32 minutes ago by MyAppName) to the appID that's contained in the web.config not to the appID that's been set in code.

Obviously as I am setting the appID programiatically I would assume that this would be used to "credit" to post.

This is how I'm initializing the app, etc

var fbApplication = new DefaultFacebookApplication { AppId = application.FBAppID, AppSecret = application.FBAppSecret };
                var current = new FacebookWebContext(fbApplication);

                Facebook.Web.FacebookWebClient client = new Facebook.Web.FacebookWebClient(fbApplication);
                client.AccessToken = current.AccessToken;

Debugging the app I can see that the correct appID and appSecret have been set. I'm using the POST method on the client to perform the post to wall.

object resTest = client.Post("/me/feed", dataTest);

Any help / direction would be much appreciated.


Solution

  • According to the Post graph object documentation there is a "from" field. Add the sender's id to the dataTest object like so (assuming dataTest is dynamic):

    dataTest.from = senderFacebookId;