【发布时间】:2021-07-22 15:29:16
【问题描述】:
我正在尝试通过 PowerShell 或 API 将 Office 365 组之一添加为 SharePoint 在线网站中的网站集管理员,但我没有得到任何解决方案。 我可以从站点 UI 手动完成,但我想自动化它,所以寻找 Powershell 或 API。
【问题讨论】:
标签: powershell sharepoint office365 sharepoint-online azure-automation
我正在尝试通过 PowerShell 或 API 将 Office 365 组之一添加为 SharePoint 在线网站中的网站集管理员,但我没有得到任何解决方案。 我可以从站点 UI 手动完成,但我想自动化它,所以寻找 Powershell 或 API。
【问题讨论】:
标签: powershell sharepoint office365 sharepoint-online azure-automation
您可以使用 PnP PowerShell cmdlet Add-PnPSiteCollectionAdmin -owners。
参考:https://github.com/pnp/powershell/blob/dev/documentation/Add-PnPSiteCollectionAdmin.md
我们需要注意的是,与文档所说的不同,我们需要像i:0#.f|membership|user1@contoso.sharepoint.com一样使用LoginName
所以对于 O365 组,应该是 c:0o.c|federateddirectoryclaimprovider|<Object ID>
对于安全组,它应该像c:0t.c|tenant|<Object Id>
【讨论】: