开发者

(Facebook C# SDK) Getting friends profile picture

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜