问题
I m working on a Facebook App. Not a website.
I am trying to use Facebook C# SDK and trying to get Current User and Query Current User info. How do i do that?
Also, When i try to use an app it s asking for Adding the app, requesting permission to access data, how do i do that also?
Is there a comprehensive examples of these things?
回答1:
If you're stuck working with .NET 3.5, this will work:
var facebookClient = new FacebookClient(FacebookAccessToken);
var me = facebookClient.Get("me") as JsonObject;
var uid = me["id"];
回答2:
You need the access token. Once you get the access token make a request to me
var fb = new FacebookClient("access_token");
dynamic result = fb.Get("me", new [] { fields = "id" });
var userId = result.id;
来源:https://stackoverflow.com/questions/10094652/facebook-c-sharp-sdk-get-current-user