This blog post was authored by Sanjeev Dwivedi, a developer evangelist for Microsoft working with Facebook.
- Adam
Today we are pleased to share with you that Facebook has announced the Facebook SDK for .NET as part of the Facebook Technology Partners program. This is a C#/XAML–based SDK that makes integrating your Windows Phone and Windows 8 style apps with Facebook a breeze. The SDK is an open-source project owned and released by the Outercurve Foundation. The Outercurve website for the SDK is http://facebooksdk.net, which hosts tutorials for both Windows 8 and Windows Phone, and has links to the GitHub repository where the source is hosted.
You can easily integrate the SDK into your project using NuGet, which automatically downloads and installs the SDK in your project. To do this, launch the Package Manager Console from the toolbar:
Tools > Library Package Manager > Package Manager Console
Install the Facebook NuGet package as part of your app by running the following command:
Install-Package Facebook
The Facebook SDK for .NET makes your life easier by providing two key functionalities:
- It takes away all of the complexity of logging on with Facebook. Based on the provided samples, all you need to do is use a bit of boilerplate code, add your Facebook app ID to the mix, and voila! You can have people logging on to your app with Facebook.
- It allows you to focus on your Facebook-related scenarios by abstracting away the low-level details such as HTTP connections and query parameters. This way you can plan and develop around Open Graph APIs and objects, which is where you want to spend your development resources.
Code Snippet
- // Instantiate the Facebook client
- FacebookClient fb = new FacebookClient("<Supply Access Token here>");
- // Make the friends list Open Graph API request
- var friendsTaskResult = await fb.GetTaskAsync("/me/friends");
- var result = (IDictionary<string, object>)friendsTaskResult;
- var data = (IEnumerable<object>)result["data"];
- foreach (var item in data)
- {
- var friend = (IDictionary<string, object>)item;
- // Pick out the properties from the dictionary without the need for writing deserializing classes
- string name = (string)friend["name"];
- string id = (string)friend["id"];
- }
The offerings and resources presented may be relevant to developers. However, this post is for informational purposes only and Microsoft is providing this information "as is" with no warranties. Each contribution is licensed to you under an agreement by its provider, not Microsoft. It is your responsibility to evaluate if these resources are suitable for your usage.
DIGITAL JUICE
No comments:
Post a Comment
Thank's!