开发者

(Facebook C# SDK) Getting friends profile picture

开发者 https://www.devze.com 2023-02-16 08:18 出处:网络
I\'ve got th following (working) code which returns a list of all my (current user) friends. I would now like to also get their public profile picture. How is that done?

I've got th following (working) code which returns a list of all my (current user) friends. I would now like to also get their public profile picture. How is that done?

        var authorizer = new Authorizer();

         开发者_StackOverflowif (authorizer.IsAuthorized())
         {
             if (authorizer.Session != null)
             {
                 var token = authorizer.Session.AccessToken;

                 if (!string.IsNullOrEmpty(token))
                 {
                     var client = new FacebookClient(token);
                     dynamic me = client.Get("me");
                     string firstName = me.first_name;
                     string lastName = me.last_name;

                     dynamic myInfo = client.Get("/me/friends");
                     if (myInfo != null)
                     {
                         foreach (dynamic friend in myInfo.data)
                         {
                             Response.Write("Name: " + friend.name + "<br/>Facebook id: " + friend.id + "<br/><br/>");
                         }
                     }

                 }
             }
         }

// Nicke


This works also: http://graph.facebook.com/me/friends?fields=picture

0

精彩评论

暂无评论...
验证码 换一张
取 消