我正在尝试使用python中的REST GET调用获取RoleDefinitionBindings
问题是在某些电话上我得到了正确的响应,即
https://my_company.sharepoint.com/_api/Web/RoleAssignments(25)/RoleDefinitionBindings
但是另一方面,我得到“拒绝访问”。即在
https://my_company.sharepoint.com/sites/Company/_api/Web/RoleAssignments(4)/RoleDefinitionBindings
我知道
AccessDeniedError(“ 403:https://my_company.sharepoint.com/sites/Company/_api/Web/RoleAssignments(4)/RoleDefinitionBindings: {'odata.error':{'code':'-2147024891,System.UnauthorizedAccessException', 'message':{'lang':'en-US', 'value':'访问被拒绝。您无权执行此操作或访问此资源。'}}}“)
我不知道是什么问题, 我在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"
答案 0 :(得分:1)
问题是我不是SharePoint网站的管理员(尽管我是Azure AD的管理员)。 将自己作为管理员添加到SharePoint后,问题就解决了