Sunday 6 December 2020

Change SharePoint Online list or library Internal name

 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 wrong internal name. In starting it worked well but as the additional functionality 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 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.



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. 


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:

 #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  

No comments:

Post a Comment