First download the Facebook related dynamic library, download the file: Facebook.dll
To obtain the authorization token method:
Private stringSettoken (stringGetToken)//Here is your short token, get a two month long token by token {stringShortlivedtoken =GetToken; varClient =Newfacebookclient (); IDictionary<string,Object>result; Try{result= client. Get ("/oauth/access_token",New{Grant_type="Fb_exchange_token", client_id="your ID", Client_secret="your secret.", Fb_exchange_token=Shortlivedtoken}) asidictionary<string,Object>; } Catch(Exception ex) {Throw NewException (ex. Message); } stringtoken = result["Access_token"] as string; returntoken; }
Get the JSON string method:
Public stringGETDATAFROMFB (stringAccess_token) { if(!string. IsNullOrEmpty (Access_token)) {Try { Objectpage =NULL; varClient =Newfacebookclient (Access_token); Page= client. Get ("https://graph.facebook.com/v2.0/content name/posts?limit=10&access_token="+Access_token); returnpage. ToString (); } Catch(Exception ex) {Throwex; } } Else { return "token cannot be found"; } }
Facebook obtains JSON data with OAuth validation