Change SharePoint Online List Or Library Internal Name

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”
 
Change SharePoint Online List Or Library Internal Name
 

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,
  1. In SharePoint Designer, Open your site.
  2. 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.

  3. Find your list there
  4. Right-click list
  5. Rename.
Change SharePoint Online List Or Library Internal Name
 

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,
  1. #Set Parameters  
  2. $SiteURL = "Site URL"  
  3. $ListName = "Library Internal Name"  
  4. $NewListURL = "New Library Name"  
  5.     
  6. #Connect to PNP Online  
  7. Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)  
  8.    
  9.  #this will change URL  
  10. #Get the List  
  11. $ListGet-PnPList -Identity $ListName -Includes RootFolder  
  12.    
  13. #sharepoint online powershell change list url  
  14. $List.Rootfolder.MoveTo($NewListURL)  
  15. Invoke-PnPQuery  
  16.   
  17. #this will change library title  
  18. 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:
  1. #Set Parameters  
  2. $SiteURL = "Site URL"  
  3. $ListName = "Library Internal Name"  
  4. $NewListURL = "New Library Name"  
  5.     
  6. #Connect to PNP Online  
  7. Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)  
  8. Set-PnPList -Identity $ListName -Title $NewListURL