SharePoint / Office 365 - Changing The URL Of The List

Scenario

In one of the our SharePoint online projects, my colleague created the 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 into the list. Everything is OK now. 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.

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 list and import excel but in some cases like where workflows are associated and executed or there were 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?

First thought that came to mind is “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
      Figure 1 : List General Settings

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 it is possible to change the URL of the list with PowerShell command?

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

  1. #Web url where is the list exist, of which we need to change the URL  
  2. $url = ""   
  3.   
  4. $userName ="" # Your site user name  
  5. $password ="" # Password  
  6.  
  7. # convert password into secured string  
  8. $securedpw = ConvertTo-SecureString $password -AsPlainText -Force  
  9.  
  10. #Creating instance of client context  
  11. [Microsoft.SharePoint.Client.ClientContext]$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url)  
  12.   
  13. $clientContext.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $securedpw)  
  14.  
  15. #Fetching the list  
  16. $web = $clientContext.Web  
  17. $lists = $web.Lists  
  18. $clientContext.Load($web)  
  19. $clientContext.Load($lists)  
  20. $clientContext.ExecuteQuery()  
  21.   
  22. $list =$lists.GetByTitle("TestList") # TestList is also the title of list which we want to change  
  23. $clientContext.Load($list)  
  24.   
  25. $Context.ExecuteQuery()   
  26.  
  27. #Fetching the RootFolder of the list  
  28. $rootfolder = $list.RootFolder  
  29.  
  30. #Move the root folder to new URL  
  31. $rootfolder.MoveTo("NewURL") # NewURL - new url of the list  
  32.   
  33. $Context.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 “All Files” option as shown in below fig 2,

    all
            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 as

    list
                                  Figure 3 : SharePoint Designer - Renaming the list

  5. Once list is renamed it changes the URL.

    Thanks!

    Enjoy Reading :)

    As usual any feedback / query / suggestions are most welcome !!!
Read more articles on SharePoint:
  • Task Management In SharePoint (On-Prim/Online) - Part Four
  • SharePoint 2013: Promoted Search Results

Up Next
    Ebook Download
    View all
    Learn
    View all