Change list URL without losing /Lists/ in the URL??

Frequent Visitor

All the PowerShell scripts I've found so far which provide a way to rename the URL of a List in SPO move the list to the path /sitename/newlistname instead of maintaining /sitename/Lists/newlistname. 

 

# Set Parameters
$SiteURL = "https://domain.sharepoint.com/sites/Support/"
$ListGUID = "fe67670b-1ae7-49e2-a20c-7b0c2dbe4b20"
$NewListURL = "RenamedList"

# Connect to PNP Online
Connect-PnPOnline -Url $SiteURL -Interactive
 
# Fetch the list by it's GUID 
$list = Get-PnPList -Identity $ListGUID

# Rename the list relative url to the url 
$list.Rootfolder.MoveTo($NewListURL)
Invoke-PnPQuery

 


Is this a limitation in the way PNP/PowerShell works? Is there any way to do this without losing /Lists/ in the URL?

1 Reply

@andgoo 

This seems to work.  Change this:

$NewListURL = "RenamedList"

to include the Lists path:

 $NewListURL = "Lists/RenamedList"