通过 REST 的 Sharepoint API

问题描述 投票:0回答:1

我在 sharepoint 中创建了一个“应用程序”,并为其授予了 xmlt 权限。 我试图从我的网站获取列表内容,但由于错误 403,无法通过 http 请求获取它。

现在我通过 http oauth2 使用以下网址请求令牌: http://accounts.accesscontrol.windows.net/MyTopSecretTenantId/tokens/Oauth/2/

这给了我一个 access_token,我想通过以下链接从我的共享点 API 获取列表: https://3bac.sharepoint.com/sites/TestGroup/_api/web/list 标题: 内容类型:application/json 接受:application/json;odata=verbose 持有者:TheTokenFromTheFirstRequest

但是它给了我一个 403:禁止 "value": "访问被拒绝。(HRESULT 异常:0x80070005 (E_ACCESSDENIED))"

这是我尝试过的XML部分。

<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
<AppPermissionRequest Scope="https://sharepoint/content/sitecollection" Right="FullControl" />
<AppPermissionRequest Scope="https://sharepoint/content/sitecollection/web" Right="FullControl" />
<AppPermissionRequest Scope="https://sharepoint/content/sitecollection/web/list" Right="FullControl" />
</AppPermissionRequests>

如果能够了解 XML 的外观如何才能读取和写入列表中的项目,那就太好了。 感谢您的每一次帮助!

rest sharepoint
1个回答
0
投票

如果您只需要获取列表。我建议您在以下链接中注册应用程序

https://3bac.sharepoint.com/sites/TestGroup/_layouts/15/appregnew.aspx

并在链接中应用以下xml

https://3bac.sharepoint.com/sites/TestGroup/_layouts/15/appinv.aspx

<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
</AppPermissionRequests>

这里有一篇不错的文章可供参考

https://global-sharepoint.com/sharepoint-online/in-4-steps-access-sharepoint-online-data-using-postman-tool/?expand_article=1

© www.soinside.com 2019 - 2024. All rights reserved.