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].sharepoint.com/sites/[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)
Invoke-PnPQuery

2 thoughts on “Changing the URL of a SharePoint List using PnP PowerShell

  1. Hey, updating your recommendation to iron out a couple potholes I fell into as a novice PnP PowerShell user.

    # Connect to a SharePoint site using PnP Powershell
    Connect-PnPOnline -Url https://%5Byour-tenant%5D.sharepoint.com/sites/%5Byour-site%5D -Interactive

    # Fetch the list by its GUID
    # Can be found from the url when navigating to list settings, make sure to URL decode the ID
    # Example GUID 3e5ac11a-6980-48e0-8bf3-61613566b2ba
    $list = Get-PnPList -Identity “[GUID of the list you want to move]”

    # Rename the list relative url to the url
    $list.RootFolder.MoveTo(“[your new list url]”)

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

    Like

Leave a Reply to Bart Korn Cancel reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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