Using Facebook SDK (http://facebooksdk.codeplex.com/), you do something like this...
        string myAccessToken = "something";
        FacebookClient client = new FacebookClient(myAccessToken);
        IDictionary<string, object> friendData = (IDictionary<string, object>)client.Get("/me/friends");
Now how do you get the friends data out from the dictionary?
Your function for storing friends list from json data:
string myAccessToken = "something";         
FacebookClient client = new FacebookClient(myAccessToken);         
var friendListData = client.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);
}
Class for facebook user
Class FbUser {
    String Id { set; get; }
    String Name { set; get; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With