Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Microsoft SharePoint API访问被拒绝_Sharepoint_Sharepoint Api - Fatal编程技术网

Microsoft SharePoint API访问被拒绝

Microsoft SharePoint API访问被拒绝,sharepoint,sharepoint-api,Sharepoint,Sharepoint Api,我正在尝试使用python中的REST get调用获取RoleDefinitionBindings 问题是在一些电话中我得到了正确的回应,即 https://my_company.sharepoint.com/_api/Web/RoleAssignments(25)/角色定义绑定 但另一方面,我得到“访问被拒绝”。即 https://my_company.sharepoint.com/sites/Company/_api/Web/RoleAssignments(4) /RoleDefinitio

我正在尝试使用python中的REST get调用获取
RoleDefinitionBindings

问题是在一些电话中我得到了正确的回应,即

https://my_company.sharepoint.com/_api/Web/RoleAssignments(25)/角色定义绑定

但另一方面,我得到“访问被拒绝”。即

https://my_company.sharepoint.com/sites/Company/_api/Web/RoleAssignments(4) /RoleDefinitionBindings

我明白了

AccessDeniedError(“403:: {'odata.error':{'code':'-2147024891,System.UnauthorizedAccessException', 'message':{'lang':'en-US', “值”:“访问被拒绝。您没有执行此操作或访问此资源的权限。”}”)

我想不出是什么问题, 我正在Active Directory中为我的应用使用ShapePoint的所有可能作用域:

    "https://my_company.sharepoint.com/AllSites.FullControl",
    "https://my_company.sharepoint.com/AllSites.Read",
    "https://my_company.sharepoint.com/User.Read.All",
    "https://my_company.sharepoint.com/AllSites.Manage",
    "https://my_company.sharepoint.com/AllSites.Write",
    "https://my_company.sharepoint.com/MyFiles.Read",
    "https://my_company.sharepoint.com/MyFiles.Write",
    "https://my_company.sharepoint.com/Sites.Search.All",
    "https://my_company.sharepoint.com/TermStore.Read.All",
    "https://my_company.sharepoint.com/TermStore.ReadWrite.All",
    "https://my_company.sharepoint.com/User.ReadWrite.All"

问题是我不是SharePoint网站的管理员(尽管我是Azure广告的管理员)。
一旦我将自己添加为SharePoint的管理员,问题已解决

您的应用程序帐户是否已在sharepoint网站上添加了您试图访问的任何权限集?@DeividKamui是-我已为我的应用程序授予了上述所有权限我的意思是在sharepoint网站内,您需要将active directory帐户添加到适当的权限组,即:网站所有者,站点成员我不知道我也需要这样做。谢谢顺便说一句,你知道怎么做吗?你需要请求你的SharePoint管理员将该帐户添加到任何可用的权限组中(如果你计划访问任何其他rest操作(如创建库或列表),完全控制会很好)。如果您是管理员,请访问网站设置,然后访问网站权限并添加您的帐户。如果您仍然有问题,仍然有其他选项可以访问SharePoint rest API,但您需要编写更多代码。