我正在使用beta microsoft graph请求来扩展列表项的字段。像这样:
GET https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items/{item-id}?expand=fields
根据我的权限,我遵守Sites.ReadWrite.All的先决条件。但我仍然收到401以下的回复正文:
{
"error": {
"code": "unauthenticated",
"message": "Access denied. You are not authorized to perform this operation or open this resource.",
"innerError": {
"request-id": "xxx-xx-xxx-xx-xxxxxxxxx",
"date": "2017-05-30T08:46:28"
}
}
}
修改 即使没有扩展,响应现在是401.因此请求单个项目也会给出401.使用的http请求和标题是:
GET https://graph.microsoft.com/beta/sites/xxxxxxxxxxx.sharepoint.com,2f72ee36-b572-4919-bc5f-66a41f8fd128,f01a93c4-ce7a-4b37-b214-d868d39204ef/lists/fa190d14-7ab0-42a3-860d-d1cde4d93ccf/items/853adfa7-d114-425c-998f-54a58496bfbc HTTP/1.1
Host: graph.microsoft.com
Connection: keep-alive
Origin: https://developer.microsoft.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Authorization: Bearer yyyyyyyyyyyyyyyyyyyyyyyyy
Referer: https://developer.microsoft.com/en-us/graph/graph-explorer
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4
回应:
HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Type: application/json
request-id: xxx-xx-xxx-xx-xxxxxxxxx
client-request-id: xxx-xx-xxx-xx-xxxxxxxxx
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceA","ScaleUnit":"002","Host":"AGSFE_IN_1","ADSiteName":"AMS"}}
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Location, Preference-Applied, Content-Range, request-id, client-request-id
Duration: 320.1951
Date: Wed, 31 May 2017 08:43:44 GMT
Content-Length: 298
{
"error": {
"code": "unauthenticated",
"message": "Toegang geweigerd. U bent niet gemachtigd om deze bewerking uit te voeren of deze bron te openen.",
"innerError": {
"request-id": "xxx-xx-xxx-xx-xxxxxxxxx",
"date": "2017-05-31T08:43:44"
}
}
}