Call friends profile image with API GRAPH

-1

How do I call my friends' profile picture?

I can already find this way me/picture?redirect=false .

    
asked by anonymous 22.10.2014 / 14:51

1 answer

0

Basically the command is

public ActionResult Index()
{
    if (StatusAutorizacao())
    {
        Facebook.FacebookClient client = new Facebook.FacebookClient(access_token);
        client.AppId = App_Id;
        client.AppSecret = App_Secret;
        dynamic friends = client.Get("me/friends/?fields=name,birthday,picture, gender");
        IEnumerable  listafriends = (from c in ((IEnumerable)friends.data)
                                select new
                                {
                                    Id = c.id, 
                                    Name = c.name,
                                    Birthday = c.birthday,
                                    Picture = c.picture.data.url,
                                    Sexo = c.gender
                                }).AsEnumerable();
        return View(listafriends);
    }
    else
    {
        return null;
    }
}

And in the index, you put the view

@model IEnumerable  
@{
    ViewBag.Title = "Index";
}                            

Index

@foreach (object item in Model) { Type type = item.GetType(); @String.Format("{0} {1}", type.GetProperty("Id").GetValue(item,null).ToString(), type.GetProperty("Name").GetValue(item,null).ToString()) }
    
22.10.2014 / 15:13