How to Change a Group Name in SharePoint Online?

Requirement: Change Group Name in SharePoint Online

SharePoint Online: Change Group Name
To rename a SharePoint Online user group, Navigate to:
  • Site settings >> Site permissions >> Click on the group name
  • On the group page, Click on the "Group Settings" from Settings Menu
    sharepoint online change group name
  • Provide a name for your SharePoint Online group.
    sharepoint online rename group
  • Click on OK to save your changes.

Rename Group in SharePoint Online using PowerShell
You can renaming a SharePoint group using PowerShell. Here is my PowerShell script to rename a group in SharePoint Online.
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Function to Rename a Group
Function Rename-SPOGroup([String]$SiteURL, [String]$OldGroupName,[String]$NewGroupName)
{
    Try {
        #Get credentials to connect
        $Cred= Get-Credential
        $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
 
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Credentials

        #Get the Group by name
        $Group=$Ctx.web.SiteGroups.GetByName($OldGroupName)

        If($Group -ne $Null)
        {
            #Rename the group
            $Group.Title = $NewGroupName
            $Group.Update()
            $Ctx.ExecuteQuery()

            write-host -f Green "Group '$OldGroupName' Renamed to '$NewGroupName' Successfully!" $_.Exception.Message
        }
    }
    catch {
        write-host "Error Renaming Group: $($_.Exception.Message)" -foregroundcolor Red
    }
}

#Variables
$SiteURL="https://crescenttech.sharepoint.com/"
$OldGroupName = "Team Site Members"
$NewGroupName = "Marketing Managers"

#Call the function
Rename-SPOGroup -SiteURL $SiteURL -OldGroupName $OldGroupName -NewGroupName $NewGroupName

PnP PowerShell to Change Group Name in SharePoint Online:
#Config Variables
$SiteURL = "https://crescenttech.sharepoint.com/Sales"
$GroupName= "Sales Portal Members"
$NewGroupName ="Sales Managers"

#Connect PNP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#Update the Group Name
Set-PnPGroup -Identity $GroupName -Title $NewGroupName
How to Change a Group Name in SharePoint Online? How to Change a Group Name in SharePoint Online? Reviewed by Salaudeen Rajack on February 03, 2018 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.