添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporting an Issue or Missing Feature

Please confirm what it is that your reporting

Bug: Add-PnPGroupMember does not work for "Everyone except external users". The code below used to work with Add-PnPUserToGroup cmdlet, it throws an error now.

Expected behavior

"Everyone except external users" is added to the specified SharePoint group (e.g. Visitors)

Actual behavior

Error message:
Add-PnpGroupMember: Exception has been thrown by the target of an invocation.

Steps to reproduce behavior

Connect-PnPOnline $siteUrl -UseWebLogin
$ctx = Get-PnPContext
$web = Get-PnPWeb -Includes WebTemplate, Configuration
$Principal = [Microsoft.SharePoint.Client.Utilities.Utility]::ResolvePrincipal($ctx, $web, "Everyone except external users", "All", "All", $Null, $True)
$ctx.ExecuteQuery()
$everyoneLoginName = $Principal.Value.LoginName
Add-PnPGroupMember -LoginName $everyoneLoginName -Identity $web.AssociatedVisitorGroup

What is the version of the Cmdlet module you are running?

1.2.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
  • changed the title [BUG] Add-PnPGroupMember does not work for "Everyone except external users" Add-PnPGroupMember does not work for "Everyone except external users" Feb 1, 2021

    Behind the scenes we are not using CSOM anymore in this cmdlet to acquire the correct group, for that reason we require the group to have the ID property loaded before we can add a member to it.

    In a more 'powershell' way, this works with the release you have installed:

    $user = Get-PnPUser | ?${$_.Title -eq "Everyone except external users"} # but your approach to find the principal will work too
    $group = Get-PnPGroup -AssociatedVisitorGroup
    Add-PnPGroupMember -Login $user.LoginName -Group $group

    We will merge an update today which will actually resolve the id of the group if not specified before we try to add the user to group. This change will be available in release 1.2.11-nightly.