SharePoint Online: Move Users from One Group to Another

Requirement: Move users from one group to another in SharePoint Online.

How to Move Users Between SharePoint Online Groups?

Well, there is no direct way to copy or move users between SharePoint Online groups. But you can achieve it by following the below steps:

  • Click on Settings gear >> Site Settings
  • Click on “People and Groups” under the “Users and Permissions” group
  • Select the Source group name from left navigation >> Select All Users by ticking the checkbox in the header >> Click on “E-mail Users” from the “Actions” menu. This opens the default Email client with all users of the group. Copy them! 
    sharepoint online move users from one group to another
  • Navigate to the destination group in SharePoint Online site>> Click on “Add users and paste those copied Email.

The above method could be relatively simpler when you have to copy or move few users between SharePoint groups. Wouldn’t it be better to use the scripted way to copy multiple users in bulk?

SharePoint Online: Move Users from One Group to Another using PowerShell

Here is how you can move users from one group to another in SharePoint Online:

#Config Variables
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
$SourceGroupName = "Marketing Team"
$DestinationGroupName = "Marketing Managers"

#Connect to PNP Online
Connect-PnPOnline -Url $SiteURL -UseWebLogin

#Get Members of the Source Group
$SourceGroup = Get-PnPGroup -Identity $SourceGroupName | Select-Object Users

#Add users to destination group
Foreach ($User in $SourceGroup.Users)
{
    #Frame User ID
    $UserID = "i:0#.f|membership|"+$User.Email
    #Add user to Group
    Add-PnPUserToGroup -LoginName $UserID -Identity $DestinationGroupName

    #Remove user from source group
    Remove-PnPUserFromGroup -LoginName $UserID -Identity $SourceGroupName

    Write-host "User Moved :"$User.Email
}

You can comment the “Remove-PnPUserFromGroup” (Line#20) to perform copy users between groups.

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

One thought on “SharePoint Online: Move Users from One Group to Another

  • May 27, 2021 at 1:17 PM

    Thx!!! You ‘re saved my day 🙂

    Reply

Leave a Reply