c# - Getting my friend from facebook -


i'm learning facebook api writing simple console appliction. i'm trying simple things, code examples found on web (and in stackoverflow).

the thing i'm trying do, getting of friends list [name, id].

i run code, #2500 error. here code:

class program {     static void main(string[] args)     {                    facebookclient fbclient = new facebookclient();         dynamic result = fbclient.get("oauth/access_token", new         {             client_id = <removed app id>,             client_secret = "<removed app secret>",             grant_type = "client_credentials"         });         fbclient.accesstoken = result.access_token;          var friendlistdata = fbclient.get("/me/friends");         jobject friendlistjson = jobject.parse(friendlistdata.tostring());          list<fbuser> fbusers = new list<fbuser>();         foreach (var friend in friendlistjson["data"].children())         {             fbuser fbuser = new fbuser();             fbuser.id = friend["id"].tostring().replace("\"", "");             fbuser.name = friend["name"].tostring().replace("\"", "");             fbusers.add(fbuser);         }          foreach (var item in fbusers)         {             console.writeline(item);             console.writeline();         }     } } 

what missing in code?

(sorry english)

string myaccesstoken = "something";          facebookclient client = new facebookclient(myaccesstoken);  

the myaccesstoken user token can here https://developers.facebook.com/tools/access_token/

instead of

facebookclient fbclient = new facebookclient();         dynamic result = fbclient.get("oauth/access_token", new         {             client_id = <removed app id>,             client_secret = "<removed app secret>",             grant_type = "client_credentials"         });         fbclient.accesstoken = result.access_token;`enter code here` 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -