You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
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.
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.