Changing the URL of a SharePoint List using PnP PowerShell

The Case

Sometimes you want to change the url name of a list in SharePoint Online. For example, if your list name is “Order”, the site relative url to the list is “/order”, and you want to change the name to “Orders”, only the list name can be changed in the SharePoint GUI. The URL name stays the same.

The Solution

There are different ways of solving the problem, but in this example I will use the PnP PowerShell commands to change the url name.

# Connect to a SharePoint site using PnP Powershell
Connect-PnPOnline -Url https://[your-tenant][your-site]

# Fetch the list by it's GUID (can be found from the url when navigating to list settings)
$list = Get-PnPList -Identity "[GUID of the list you want to move]"

# Rename the list relative url to the url 
$rootFolder.MoveTo("[your new list url]")

# Invoke the query (same as context.ExecuteQuery in regular CSOM)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s