我正在尝试使用python 中的REST get调用获取RoleDefinitionBindings
问题是,在一些电话中,我得到了正确的回应,即
https://my_company.sharepoint.com/_api/Web/RoleAssignments(25)/RoleDefinitionBindings
但另一方面,我得到了"访问被拒绝"。I.e在上
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:{'data.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"
问题是我不是SharePoint网站上的管理员(尽管我是Azure AD上的管理员(。一旦我将自己添加为SharePoint管理员,问题就得到了解决