【问题标题】:MS SharePoint Postman System.UnauthorizedAccessException accessing subsiteMS SharePoint Postman System.UnauthorizedAccessException 访问子网站
【发布时间】:2021-07-31 23:55:49
【问题描述】:

我的目标是使用 REST API 在 MS SharePoint 中创建任何内容(项目、文件夹、文件)。问题是,我没有设置访问权限的影响力。它是由第 3 方设立的。他们说,我可以完全访问子文件夹。它是这样的:https://xxxx.sharepoint.com/sites/xxxx/mysubfolder 基本上我们在这里一步一步地进行: https://stuartmccoll.github.io/posts/2020-06-16-sharepoint-api-authentication-with-postman/

我使用 Postman 来测试这个过程。第一步是获取访问令牌。它工作正常,我明白了。 当我尝试测试 get 时 https://xxx.sharepoint.com/sites/xxxx/mysubfolder/_api/web/Lists/ 使用令牌, 我得到回复,状态为 200 OK。

当我尝试列出例如 https://xxx.sharepoint.com/sites/xxxx/mysubfolder/_api/web/Lists/GetByTitle('Postman')/items 我回来了:

{
    "d": {
        "results": []
    }
}

空的?至少有 2 项。

当我尝试使用帖子 https://xxx.sharepoint.com/sites/xxxx/mysubfolder/_api/web/Lists 创建新列表时

{
  "__metadata": {
    "type": "SP.List"
  },
  "AllowContentTypes": true,
  "BaseTemplate": 100,
 "ContentTypesEnabled": true,
 "Description": "My list description",
 "Title": "Test"
}

我收到了

{
    "error": {
        "code": "-2147024891, System.UnauthorizedAccessException",
        "message": {
            "lang": "de-DE",
            "value": "Zugriff verweigert. Sie haben keine Berechtigung, diesen Vorgang auszuführen oder auf diese Ressource zuzugreifen."
        }
    }
}

状态为 403 Forbidden。 我错过了什么/做错了什么? 谢谢。

【问题讨论】:

    标签: sharepoint postman


    【解决方案1】:

    我找到了原因。 它位于“向 SharePoint 加载项授予权限”的设置中

    一定是:

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

    然后就可以了!

    【讨论】:

      猜你喜欢
      • 2014-06-28
      • 1970-01-01
      • 2016-07-17
      • 1970-01-01
      • 2010-11-23
      • 1970-01-01
      • 1970-01-01
      • 2016-09-28
      • 2016-03-12
      相关资源
      最近更新 更多