首页 文章

Microsoft Graph API下载文件内容返回Unauthorized 401

提问于
浏览
4

我正在尝试使用“仅限应用”令牌从SharePoint Online下载文件 . 我可以使用此URL获取文件信息

https://graph.microsoft.com:443/v1.0/sites/{siteId}/drives/{driveId}/list/items/{itemId}/driveItem

但是当我尝试使用此URL下载文件时

https://graph.microsoft.com:443/v1.0/sites/{siteId}/drives/{driveId}/list/items/{itemId}/driveItem/content

我收到以下错误

403 FORBIDDEN

Content-Length →13
Content-Type →text/plain; charset=utf-8
Date →Fri, 13 Apr 2018 08:47:12 GMT
MicrosoftSharePointTeamServices →16.0.0.7604
P3P →CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
SPIisLatency →2
SPRequestDuration →53
X-Content-Type-Options →nosniff
X-MS-InvokeApp →1; RequireReadOnly
X-MSDAVEXT_Error →917656; Access+denied.+Before+opening+files+in+this+location%2c+you+must+first+browse+to+the+web+site+and+select+the+option+to+login+automatically.
X-MSEdge-Ref →Ref A: B9E0C567B0CC4E60AEE93EEB8DC06AF1 Ref B: VIEEDGE0813 Ref C: 2018-04-13T08:47:12Z
X-Powered-By →ASP.NET
X-SharePointHealthScore →0

怎么了?

它似乎在内部生成一个下载链接(... / _ layouts / 15 / download.aspx?UniqueId = ...),它与username / pwd令牌一起使用,但不适用于“仅限app”令牌

我有另一个Office 365订阅,使用“仅限app”令牌 . 另一个订阅有一个自定义域,但我看不到其他配置差异(两者都将LegacyAuthProtocolsEnabled属性设置为true,相同的共享选项......)

EDIT: 似乎我星期五测试的例子现在有效!!

3 回答

相关问题