Forum Discussion

matthewcarterACG's avatar
matthewcarterACG
Copper Contributor
Jul 20, 2023

either rename a document library url or move files to new library retaining metadata

Hi all,

 

we are in the process of moving files over from file explorer file server into sharepoint online.

we are using sharepoint migration tool to do this, all works well, and metadata retained.

We have since found out we have character limit issues when syncing back to file explorer. So we are now wanting to rename this document library to a new URL, or create a new document library, and move files over also retaining the metadata of the files.

so 2 questions.

 

is there any method to rename the URL of a document library either using GUI, Powershell, Sharepoint Designer.

 

or, how can we move files to a new document library that retains the metadata. using Sharepoint migration or Sharepoint Designer cut / paste does not retain the file created date, or the name of last modified.

1 Reply

  • SvenSieverding's avatar
    SvenSieverding
    Bronze Contributor

    Hi matthewcarterACG ,

    if you use PnP Powershell (https://pnp.github.io/powershell/) then you can change the url part of a list like this

    $OldListName = "Doc1"
    $NewListURL = "Doc1a"
    
    $List.Rootfolder.MoveTo($NewListURL)
    Invoke-PnPQuery


    if you have an identical library doc2 (with the same metdata columns als doc1a) then you can use the "Move-PnPFile" Commandlet to move a file including all metadata and the history (as long as you stay in the same site collection)

    Move-PnPFile -SourceUrl "doc1a/Document.docx" -TargetUrl "doc2"


    Best Regards,
    Sven

Resources