【问题标题】:Sharepoint Online REST API System.UnauthorizedAccessException when trying to get SiteGroup/UsersSharepoint Online REST API System.UnauthorizedAccessException 尝试获取 SiteGroup/Users 时
【发布时间】:2019-04-10 18:21:19
【问题描述】:

我正在尝试通过调用此 REST API 从 Sharepoint Online 获取 SiteGroup/Users: /_api/web?$expand=webs,lists,AllProperties,ThemeInfo,SiteUsers,SiteGroups,SiteGroups/Users,RoleDefinitions&$select=*

虽然在某些客户的共享点网站上运行良好,但在其他方面却失败了:

{"error":{"code":"-2147024891, System.UnauthorizedAccessException","message": 
{"lang":"en-US","value":"Access denied. You do not have permission to perform 
this action or access this resource."}}}

当我删除 SiteGroups/Users 时,它工作正常,但我需要 SiteGroups/Users。在这两种情况下,我访问的用户都是网站集管理员。所以,我试图了解管理员之间的区别,在一种情况下可以正常工作,但在另一种情况下不能。 谢谢

【问题讨论】:

    标签: sharepoint sharepoint-online sharepoint-rest-api


    【解决方案1】:

    这是因为您在错误的 URL 上完成了应用注册,例如,如果您的 SharePoint 文件基础 URL 是 https://yourtenantname.sharepoint.com/sites/yourfoldername 然后使用此 URL 进行应用注册 https://yourtenantname.sharepoint.com/sites/yourfoldername/_layouts/15/appregnew.aspx 而不是此 https://yourtenantname.sharepoint.com/_layouts/15/appregnew.aspx

    您可以参考这篇文章为您的应用注册 REST API: https://anoopt.medium.com/accessing-sharepoint-data-using-postman-sharepoint-rest-api-76b70630bcbf

    【讨论】:

    • 这与应用注册有什么关系?我对 OAuth 只字未提。就我而言,这是基本身份验证(用户名和密码)
    猜你喜欢
    • 1970-01-01
    • 2020-08-07
    • 1970-01-01
    • 2019-10-23
    • 1970-01-01
    • 1970-01-01
    • 2012-06-26
    • 2011-05-28
    • 2021-07-22
    相关资源
    最近更新 更多