我使用下面的代码我得到了朋友的名字,个人资料图片和身份证但我需要朋友名单的用户名
protected void Page_Load(object sender, EventArgs e)
{
FaceBookConnect.API_Key = "<App_id>";
FaceBookConnect.API_Secret = "<App_Secret_Id>";
if (!IsPostBack)
{
string code = Request.QueryString["code"];
if (!string.IsNullOrEmpty(code))
{
string data = FaceBookConnect.Fetch(code, "me/friends");
FaceBookData facebookData = new JavaScriptSerializer().Deserialize<FaceBookData>(data);
foreach (FaceBookUser user in facebookData.Data)
{
user.PictureUrl = string.Format("https://graph.facebook.com/{0}/picture", user.Id);
user.Email = string.Format("https://graph.facebook.com/{0}?fields=username", user.Id);
}
gvFriends.DataSource = facebookData.Data;
gvFriends.DataBind();
}
}
}
protected void btnFetch_Click(object sender, EventArgs e)
{
FaceBookConnect.Authorize("user_photos,friends_about_me,friends_photos", Request.Url.AbsoluteUri);
}
答案 0 :(得分:0)
您将在结果中获得JSON:
myJSON = string.Format("https://graph.facebook.com/{0}?fields=username", user.Id);
您可以使用myJSON.username