SharePoint / Office 365 - Changing The URL Of The List

Scenario

In one of our SharePoint online projects, my colleague created a list called “TestList” in which the URL of the list becomes “/Lists/TestList/AllItems.aspx.” Our customer had given us the Excel sheet and we need to import the Excel content in the list. Excel content was imported successfully and around 600 items were added to the list. Everything is OK now. The only thing is that the URL of the list is “TestList” and not the proper list. My colleague created it with the intention of testing it.

Now a simple approach to have a proper list URL is to create a new list with the proper URL. Import the Excel again to the list and we are done. Here this is possible because we only need to create a list and import Excel but in some cases like where workflows are associated and executed or there are item-level permissions then it becomes a tedious and time-consuming task.

Solution

So we were wondering if rather than doing all the steps again is there any way where we can change the URL of the list directly so we don't need to create a new list and import Excel again?

The first thought that came to mind was “List Settings;” we went to list settings but couldn't find any way to change the URL of the list. As shown below in the “General Settings” of the list.

List Settings

Figure 1. List General Settings

The only possible option is to change the List name, description, and navigation but not the URL.

The next thought that came was of PowerShell and whether it is possible to change the URL of the list with a PowerShell command.

We need to move the RootFolder of the list to a new URL, following is the small PowerShell script to change the URL of the list in SharePoint online.

# Web url where the list exists, of which we need to change the URL
$url = ""
$userName = "" # Your site username
$password = "" # Password
# Convert password into secured string
$securedpw = ConvertTo-SecureString $password -AsPlainText -Force
# Creating instance of client context
[Microsoft.SharePoint.Client.ClientContext]$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$clientContext.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $securedpw)
# Fetching the list
$web = $clientContext.Web
$lists = $web.Lists
$clientContext.Load($web)
$clientContext.Load($lists)
$clientContext.ExecuteQuery()
$list = $lists.GetByTitle("TestList") # TestList is the title of the list we want to change
$clientContext.Load($list)
$clientContext.ExecuteQuery()
# Fetching the RootFolder of the list
$rootfolder = $list.RootFolder
# Move the root folder to new URL
$rootfolder.MoveTo("NewURL") # NewURL - new URL of the list
$clientContext.ExecuteQuery()

There is one more alternative to change the URL of the list using the SharePoint designer.

  1. Open the SharePoint designer.
  2. Go to the “All Files” option as shown below fig 2.
    All Files
    Figure 2. SharePoint Designer - All Files.
  3. Go to the list in which we need to change the URL.
  4. Right-click on it and Rename it as.
     SharePoint
    Figure 3. SharePoint Designer - Renaming the list
  5. Once the list is renamed it changes the URL.

Thanks!

Enjoy Reading!

As usual, any feedback/queries/suggestions are most welcome.

Read more articles on SharePoint.

  • Task Management In SharePoint (On-Prim/Online) - Part Four
  • SharePoint 2013: Promoted Search Results