Issue
Recently we have provided a build and guideline document to our client and by mistake they have set up a library with the wrong internal name. In the beginning it worked well but as the additional functionality was added, it broke. As the users have started working on that, we needed to fix the internal name anyway.
Our library internal name is “TrainingDocuments” and display name is “Training Documents”. While Client has set up “Training Documents”
Solution
Initially we thought it might be not possible. But then we found 2 ways to do it,
Approach 1 - Using SharePoint Designer 2013
Follow the below steps to fix this using SharePoint Designer 2013,
- In SharePoint Designer, Open your site.
- Navigate to All Files navigation node (not List and Libraries node),
Note
you will need “Site Collection Administrator” permission in the site collection to see “All Files” option.
- Find your list there
- Right-click list
- Rename.
Approach 2 - Using PNP PowerShell
In case you are not able to connect the site in the SharePoint designer or you do not have it installed in your machine, you can do this using PNP PowerShell as well.
PowerShell to change Library Name,
- #Set Parameters
- $SiteURL = "Site URL"
- $ListName = "Library Internal Name"
- $NewListURL = "New Library Name"
-
- #Connect to PNP Online
- Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
-
- #this will change URL
- #Get the List
- $List= Get-PnPList -Identity $ListName -Includes RootFolder
-
- #sharepoint online powershell change list url
- $List.Rootfolder.MoveTo($NewListURL)
- Invoke-PnPQuery
-
- #this will change library title
- Set-PnPList -Identity $ListName -Title $NewListURL
PowerShell to change List Name
For list, we don't need to execute command for root folder changes. So, the updated powershell is as follows:
- #Set Parameters
- $SiteURL = "Site URL"
- $ListName = "Library Internal Name"
- $NewListURL = "New Library Name"
-
- #Connect to PNP Online
- Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
- Set-PnPList -Identity $ListName -Title $NewListURL