【问题标题】:adding office365 group to Sharepoint site collection administrators thorugh Powershell通过 Powershell 将 office 365 组添加到 Sharepoint 网站集管理员
【发布时间】:2021-07-22 15:29:16
【问题描述】:

我正在尝试通过 PowerShell 或 API 将 Office 365 组之一添加为 SharePoint 在线网站中的网站集管理员,但我没有得到任何解决方案。 我可以从站点 UI 手动完成,但我想自动化它,所以寻找 Powershell 或 API。

【问题讨论】:

    标签: powershell sharepoint office365 sharepoint-online azure-automation


    【解决方案1】:

    您可以使用 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>

    您可以在 Azure AD 中获取组的对象 ID。

    【讨论】:

    • 我收到此错误“尝试添加用户时发生异常:”指定用户 c:0o.c|federateddirectoryclaimprovider|*************-461f -bcaf-51235ee3369b 找不到。“。将跳过用户。”通过我输入了正确的组 ID。
    • 我正在添加一个安全组
    • 它对我有用,我使用了 c:0t.c|tenant|
    • @amyy 很高兴听到你完成了它。是的 O365 组和安全组不同,您需要使用不同的前缀。我会在我的回复中更新你的答案,请接受它作为答案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-10
    • 1970-01-01
    • 2019-03-11
    • 1970-01-01
    相关资源
    最近更新 更多