Change SharePoint Online List URL
Summary
This sample script shows how to change SharePoint online list URL and rename the list after list creation using PnP PowerShell.
Scenario inspired from this blog post: Change SharePoint Online List URL using PnP PowerShell
# SharePoint online site URL
$siteUrl = "https://contoso.sharepoint.com/sites/SPConnect"
# Current display name of SharePoint list
$oldListName = "Images List"
# New list URL
$newListUrl = "Lists/LogoUniverse"
# New display name for SharePoint list
$newListName = "Logo Universe"
# Connect to SharePoint online site
Connect-PnPOnline -Url $siteUrl -Interactive
# Get the SharePoint list
$list = Get-PnPList -Identity $oldListName
# Move SharePoint list to the new URL
$list.Rootfolder.MoveTo($newListUrl)
Invoke-PnPQuery
# Rename List
Set-PnPList -Identity $oldListName -Title $newListName
Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell
The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?
Contributors
Author(s) |
---|
Ganesh Sanap |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.