May 09 2017 03:53 AM
Hi
Anyone know how to add external users to a group in an Office 365 Tenancy using (PnP) Powershell ?
(I have about 2500 external users to add)
Regards
Nigel
May 09 2017 06:00 AM
I am unsure from your question that you are trying to add external users to SharePoint group / Office 365 group.
If it was SharePoint group you can use below PnP. Please note that the external users need to be present in Azure AD before executing this script.
Add-PnPUserToGroup -LoginName user@company.com -Identity 'Marketing Site Members'
If it was Office 365 Groups, AFAIK there is no PowerShell to add external users to the group.
Nov 29 2018 09:14 AM
You can add Users to O365 Groups with this code:
Nov 29 2018 09:17 AM
Thanks @Nils Külper - that is great !
Nov 29 2018 09:26 AM
And don't forget that you need to elevate a member to the status of an owner (and vice versa) like this:
Add-UnifiedGroupLinks -Identity "Teamsite Test" -LinkType Members -Links john@doe.com
Add-UnifiedGroupLinks -Identity "Teamsite Test" -LinkType Owners -Links john@doe.com
Remove-UnifiedGroupLinks -Identity "Teamsite Test" -LinkType Owners -Links john@doe.com -Confirm:$false
Remove-UnifiedGroupLinks -Identity "Teamsite Test" -LinkType Members -Links john@doe.com -Confirm:$false
You add a new member and then you can set this contact as an owner. Works perfectly.