我已经使用 c# .net 创建了桌面 Facebook 应用程序。我想检索用户的消息、帖子和聊天记录。这是检索用户所有信息的便捷方式。我已经开始使用 Facebook Graph API,但我没有得到任何示例。
谁能帮我 ?
聚会有点晚了,但无论如何:
添加对 System.Net.Http 和 Newtonsoft.Json 的引用
string userToken = "theusertokentogiveyoumagicalpowers";
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https://graph.facebook.com");
HttpResponseMessage response = client.GetAsync($"me?fields=name,email&access_token={userToken}").Result;
response.EnsureSuccessStatusCode();
string result = response.Content.ReadAsStringAsync().Result;
var jsonRes = JsonConvert.DeserializeObject<dynamic>(result);
var email = jsonRes["email"].ToString();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21659 次 |
| 最近记录: |