X

C# Facebook Graph API Library (not maintained any more)

A C# client library for the Facebook Graph API.

Based on the Official Python client library for the Facebook Platform. Requires Newtonsoft.Json.Linq.JObject which is included in the downloads below.
You can get the facebook user from a cookie or from the query string if you are in an iframe inside a canvas page.

Download:

Download Binaries and Example v1.1
C# Facebook Graph API Library Source Code on CodePlex
Licensed under the MIT license.

Sample Code:

This is how you use the FacebookGraphAPI:

		    var args = FacebookGraphAPI.GetUserFromCookie(Request.Cookies, "YOUR_APP_ID", "YOUR_APP_SECRET");
            var facebook = new FacebookGraphAPI(args["access_token"]);

            var user = facebook.GetObject("me", null);
            Response.Write(user["name"]);

            var friends = facebook.GetConnections("me", "friends", null);
            foreach (var friend in friends["data"]) Response.Write(friend["name"]);

            var data = new Dictionary<string, string>();
            data.Add("message", "testing facebook graph api");
            var putobject = facebook.PutObject("me", "feed", data);
		

Your html page should look like:
            <fb:login-button autologoutlink="true"></fb:login-button>
    
		    <div id="fb-root"></div>
		    <script>
		      window.fbAsyncInit = function() {
		        FB.init({ appId: 'YOUR_APP_ID', status: true, cookie: true, xfbml: true});
		      };
		      (function() {
		        var e = document.createElement('script');
		        e.type = 'text/javascript';
		        e.src = 'https://connect.facebook.net/en_US/all.js';
		        e.async = true;
		        document.getElementById('fb-root').appendChild(e);
		    } ());
		    </script>

    		<a href="#" onclick="FB.login(function(response) {}, { perms: 'read_stream,publish_stream,offline_access' });">Grant permissions.</a>