How to do a post in facebook on my page fan wall with c# and asp.net

rey2k9

New Member
I tryed since 3 days how i create a post my fan page wall with c#, and i note 2 things :- Facebook provides not updated documentation with no complete and poor example (api changes often)- Facebook often changes his api and lots of post are obselete.Is somebody can correct my code or provide me the complete good code ? This is my code :\[code\] if (String.IsNullOrEmpty(Request.QueryString["code"])) { Response.Redirect("https://graph.facebook.com/oauth/authorize?client_id=157873644371673&redirect_uri=http://localhost:2551/Default.aspx&scope=publish_stream,manage_pages,offline_access&display=popup"); } else { FacebookClient fb = new FacebookClient(); dynamic result1 = fb.Get("oauth/access_token", new { client_id = "MY_APP_ID", client_secret = "MY_SECRET_ID", grant_type = "client_credentials", redirect_uri = "www.mysite.com" }); fb.AppId = "MY_APP_ID"; fb.AppSecret = "MY_SECRET_ID"; fb.AccessToken = result1.access_token; dynamic parameters = new ExpandoObject(); parameters.message = "Check out this funny article"; parameters.link = "http://www.example.com/article.html"; parameters.picture = "http://www.example.com/article-thumbnail.jpg"; parameters.name = "Article Title"; parameters.caption = "Caption for the link"; parameters.description = "Longer description of the link"; parameters.req_perms = "manages_pages"; parameters.scope = "manages_pages"; parameters.actions = new { name = "View on Zombo", link = "www.zombo.com", }; parameters.privacy = new { value = "http://stackoverflow.com/questions/15487184/ALL_FRIENDS", }; try { var result = fb.Post("/" + "MY_FACEBOOK_FAN_PAGE_ID" + "/feed", parameters); } catch (FacebookOAuthException ex) { //handle something Response.Write(ex.Message); }}\[/code\]
 
Back
Top