I am looking for the ability to programmability change the name of a sharepoint site with either Graph API or SharePoint REST (or related powershell modules)
I have tried "Set-PnPWeb" this command seems to change the site title then revert back after a bit.
In the screen shot I want to change "Site Name" (also whats the difference between "Name" and "Site Name"?)
whats the difference between "Name" and "Site Name"?
Whenever you create team site in SharePoint, Microsoft 365 group will also be created automatically with same name as site. Here, Name
refers to Microsoft 365 group name whereas Site Name
refers to SharePoint site name.
I have one SharePoint team site named demoteamsite12
with below properties:
In my case, I ran below PowerShell commands to change site name and got response like this:
$oldSiteURL = "https://xxxxxx.sharepoint.com/sites/demoteamsite12"
Connect-PnPOnline -Url $oldSiteURL -Interactive
$newSiteName = "teamsite12"
$newSiteUrl = "https://xxxxxxxx.sharepoint.com/sites/teamsite12"
Rename-PnPTenantSite -Identity $oldSiteUrl -NewSiteUrl $newSiteUrl -NewSiteTitle $newSiteName -Wait
Response:
When you check the site properties in SharePoint Admin Portal now, only site name and site address will be changed as below:
Alternatively, you can also below PowerShell script to achieve the same if above does not work:
Install-Module Microsoft.Online.SharePoint.PowerShell -force
# Connect to SharePoint Online
Connect-SPOService -Url https://xxxxxxxxx-admin.sharepoint.com
# Define the old site URL and the new site URL
$oldSiteUrl = "https://xxxxxxxxx.sharepoint.com/sites/teamsite12"
$newSiteUrl = "https://xxxxxxxxx.sharepoint.com/sites/demosite12"
# Define the new site title
$newSiteName = "demosite12"
# Start the site rename operation
Start-SPOSiteRename -Identity $oldSiteUrl -NewSiteUrl $newSiteUrl -NewSiteTitle $newSiteName
Response:
When I checked the same in SharePoint Admin Portal after few minutes, site name changed successfully as below:
Reference:
Start-SPOSiteRename (Microsoft.Online.SharePoint.PowerShell) | Microsoft