I'm learning the facebook api by writing simple console appliction. I'm trying to do simple things, with code examples I found on the web (and in stackoverflow).
The thing I'm trying to do, is getting all of MY friends list [name, id].
I run the code, but get #2500 error. Here is the 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 am I missing in my code?
(sorry for my english)