我是新的MS图形API,并试图检索SharePoint列表项目使用MS图形注册在Azure。我能够通过传递以下参数(client_id、client_secret、资源、权限)来检索访问令牌,因此在Postman中运行api url:https://graph.microsoft.com/v1.0/sites/{{site-id}}/lists/{{list-id}}/items?$Select=Id&$expand=fields($select=Title)时(通过在标头中传递比勒访问令牌)存在问题。
我收到了以下错误,说明“"403-Forbidden”中需要存在 scp或角色声明“,如果您能指导我提供正确的解决方案,那就太好了,因为我正在尝试使用C#来使用api,并且收到了以下错误声明:
using (var client = new HttpClient())
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://graph.microsoft.com/v1.0/sites/{{site-id}}/lists");
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
var response = client.SendAsync(request).Result;
//var result = requestTask.Result;
if (response.IsSuccessStatusCode)
{
var readTask = response.Content.ReadAsStringAsync();
readTask.Wait();
Console.WriteLine("Response:" + readTask);
}
}
https://stackoverflow.com/questions/58411794
复制相似问题