I am writing a test app which will simply ask the user to login to facebook via a webbrowser control. Then on the Navigated event a message box will appear relaying the user name of the user. The example I have been following uses a a FacebookClient.Get() method and so do many other examples on the net. My problem is that the FacebookClient doesn’t even contain a Get().
I am using C#4.0, and I referenced the Facebook C# SDK from NuGet.
private void wb_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
FacebookOAuthResult result;
if (FacebookOAuthResult.TryParse(e.Uri, out result))
{
if (result.IsSuccess)
{
var accesstoken = result.AccessToken;
var fb = new FacebookClient(accesstoken);
var _result = (IDictionary<string, object>)fb.Get("/me");
var name = (string)_result["name"];
MessageBox.Show("Hi " + name);
}
else
{
var errorDescription = result.ErrorDescription;
var errorReason = result.ErrorReason;
}
}
}
The Facebook C# SDK isn’t really optimised for WP7, I recommend using the facebook API without going through the sdk c#