gpt4 book ai didi

c# - client.get ("me/statuses") 使用 C# Facebook SDK 5.0.3 返回空的 "data"数组

转载 作者:太空宇宙 更新时间:2023-11-03 11:39:32 24 4
gpt4 key购买 nike

使用 C# Facebook SDK 5.0.3,客户端一切正常。Get("/me")。

但在检索状态时,我应该根据 facebook Graph API 获得一个包含所有状态消息的数组列表“数据”,但我的数据数组是空的,我得到一个“索引超出范围”异常。

有人知道我的问题是什么吗?

if (Request.Params["code"] != null)
{

var client = new FacebookClient(GetAccessToken());

dynamic me = client.Get("/me");

imgUser.ImageUrl = "https://graph.facebook.com/" + me.id + "/picture";
lblUsername.Text = me.name;
lblHometown.Text = me.hometown.name;
lblBirthday.Text = me.birthday;
lblCurrenttown.Text = me.location.name;
lblEmail.Text = me.email;
lblOpleidingen.Text = "";
lblOpleidingen.Text += me.education[1].type + ": " + me.education[1].school.name + ", " + me.education[1].year.name + "<br />"
+ me.education[0].type + ": " + me.education[0].school.name + ", " + me.education[0].year.name;
lblSex.Text = me.gender;

dynamic status = client.get("/me/statuses");

txtStatus.Text = status.data[0].message;
}

最佳答案

它需要 read_stream 权限。确保您拥有它。

您的权限数组应如下所示:

string[] extendedPermissions = new[] { "user_about_me", "read_stream" };

if (extendedPermissions != null && extendedPermissions.Length > 0)
{
var scope = new StringBuilder();
scope.Append(string.Join(",", extendedPermissions));
parameters["scope"] = scope.ToString();
}

此外,您的第二个 get() 应该大写:Get()

dynamic status = client.get("/me/statuses");

dynamic status = client.Get("/me/statuses");

关于c# - client.get ("me/statuses") 使用 C# Facebook SDK 5.0.3 返回空的 "data"数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5119086/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com