如何通过SharePoint REST API/Graph API在SharePoint在Online中找到网站所有者

发布于 2025-01-24 05:09:31 字数 831 浏览 0 评论 0原文

我正在尝试找到所有被允许在SharePoint Online中访问网站的用户。

我可以使用以下请求通过SharePoint REST API来执行此操作:

https://<tenant>.sharepoint.com/sites/<site>/_api/web/RoleAssignments?$expand=Member/Users,RoleDefinitionBindings

响应包含一些隐藏的技术帐户,已明确授予权限的用户以及成员和所有者的默认SharePoint站点组。 SharePoint站点成员组具有以下登录名:

c:0o.c|federateddirectoryclaimprovider|<UUID>

其中&lt; uuid&gt;是Azure组的ID。然后,我可以使用图形API解决其成员。但是,这里有一个用户在SharePoint UI中列为网站的所有者。

但是,SharePoint站点所有者组具有以下登录名:

c:0o.c|federateddirectoryclaimprovider|<UUID>_o

其中&lt; uuid&gt;与以前完全相同。因此,我无法使用图形API解决其成员,因为UUID为我提供了成员组,而包括后缀在内的UUID是无效的组标识符。

此外,SharePoint REST API似乎将该所有者组(以及成员组)视为用户而不是组,因此我也找不到使用此API解决其成员的方法。

那么,如何解决网站所有者的实际用户呢?

非常感谢!

I'm trying to find all users that are permitted to access a site in SharePoint Online.

I can do that via the SharePoint REST API using the following request:

https://<tenant>.sharepoint.com/sites/<site>/_api/web/RoleAssignments?$expand=Member/Users,RoleDefinitionBindings

The response contains some hidden technical accounts, users that have been granted permissions explicitly, and the default SharePoint site groups for members and owners.
The SharePoint site member group is presented with the following LoginName:

c:0o.c|federateddirectoryclaimprovider|<UUID>

Where <UUID> is the id of an Azure group. I can then resolve its members using the Graph API. However, there is a user missing here that is listed in the SharePoint UI as an owner of the site.

The SharePoint site owner group, however, is presented with the following LoginName:

c:0o.c|federateddirectoryclaimprovider|<UUID>_o

Where <UUID> is the exact same id as before. So I can't resolve its members using the Graph API as the UUID gives me the member group and the UUID including the suffix is an invalid group identifier.

Furthermore, the SharePoint REST API seems to treat this owner group (as well as the member group) like a user rather than a group, so I couldn't find a way to resolve its members using this API either.

So how can I resolve the actual users that are owners of a site?

Thank you very much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

少女七分熟 2025-01-31 05:09:31

那不是那么简单吗?

https://<tenant>.sharepoint.com/sites/<site>/_api/site/owner

Isn't it as simple as that?

https://<tenant>.sharepoint.com/sites/<site>/_api/site/owner
灵芸 2025-01-31 05:09:31

该解决方案在此处描述: https://lealen.microsoft.com/en-us/sharepoint/modern-ecperience-sharing-permissions#team-site-site-site-site-site-site-permissions-and-findice-365 groups

当您将所有者或成员添加到Microsoft 365组时,将其授予
访问SharePoint网站以及其他组合
服务。小组所有者成为现场所有者,小组成员成为现场
成员。

这意味着您可以通过以下请求检索站点所有者:

https://graph.microsoft.com/v1.0/groups/<UUID>/owners

The solution is described here: https://learn.microsoft.com/en-us/sharepoint/modern-experience-sharing-permissions#team-site-permissions-and-office-365-groups

When you add owners or members to the Microsoft 365 group, they're given
access to the SharePoint site along with the other group-connected
services. Group owners become site owners, and group members become site
members.

Which means you can retrieve the site owners with the following request:

https://graph.microsoft.com/v1.0/groups/<UUID>/owners
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文