December 23, 2020

How to change Internal name of Custom List OR Document Library in SharePoint Online

Issue:

Recently, we have provided a build and guideline document to our client and by mistake they have set up a library name with in-correct internal name. In starting it worked well but as the additional functionality added, it broke. As the users have started working on that. So, we have to fix the internal name anyway on client environment.

Our library internal name is “TrainingDocuments” and display name is “Training Documents”. but Client has set up “Training Documents” as internal name and this was not correct.



Solution: 

Initially, I thought it might not be possible and have to delete the document library and re-create from scratch on client environment. But then I've found 2 different ways to fix that.

Approach 1: Using SharePoint Designer 2013

Follow below steps to fix the internal name 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 installed in your machine, you can do this using PNP PowerShell as well.

Note - You will need Owner permission to run this PowerShell. 

PowerShell to change Library Name:

 #Set Parameters  
 $SiteURL = "Site URL"  
 $ListName = "Library Internal Name"  
 $NewListURL = "New Library Name"  
 Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)  
 $List= Get-PnPList -Identity $ListName -Includes RootFolder  
 $List.Rootfolder.MoveTo($NewListURL)  
 Invoke-PnPQuery  
 #this will change library title  
 Set-PnPList -Identity $ListName -Title $NewListURL  

PowerShell to change List Name:

 $SiteURL = "Site URL"  
 $ListName = "List Internal Name"  
 $NewListURL = "New List Name"  
 #Connect to PNP Online  
 Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)  
 Set-PnPList -Identity $ListName -Title $NewListURL  
If you have any questions you can reach out our SharePoint Consulting team here.

No comments:

Post a Comment