Move SharePoint Online files with Metadata


In this video, we talk about how to move SharePoint Online files with their metadata. We use the Patterns and Practices PowerShell cmdlets, do a quick rehash of a previous video, and then show you the magic and how you can easily apply it to other types of moves.

Cmdlets we use:
* copy-pnpfile
* remove-pnpfile
* Get-PNPListItem
* Set-PNPListItem

Original video on just moving SharePoint Online Files

Using Passwords with PowerShell

Install Patterns and Practices PowerShell cmdlets

For support, training, or more information about PowerShell check out


Xem thêm bài viết khác:


  1. Shane, thanks a lot for the video. One question, I am trying to find all the files in the Document Library (SP Online) where certain column is empty. So in your case, it will be Color is not set. The problem is, that library has more that 20 000 files and every time when I do get-PnpListItem I am getting "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator." Is there any way to overcome this limitation? Or this is something we can't change?

  2. Hi Shane,

    Thank you very much for making such helpful videos.
    i am trying to run this script to copy file with same modify and created metadata but i am getting error
    can pleas help me to run this
    i am running the following script

    $items = Get-PnPListItem -List "Documents"
    foreach ($item in $items)
    >> {
    >> $source = $item.fieldvalues.fileref
    >> $target = $targetlib + $item.fieldvalues.fileleafref
    >> Copy-PnPFile -SourceUrl $source -TargetUrl $target -Force
    >> $var1 = $item.fieldvalues.fileleafref
    >> $file = Get-PnPListItem -List $Targetlist -Query "<view><Query><where><Eq>Fieldref Name="fileleafref"/><value type ="
    >> Set-PnPListItem -List $Targetlist -Identity $file -Values @{Modified = $item.fieldvalues.Modified; Created By = $item.
    fieldvalues.Created By; Modified By = $item.fieldvalue.Modified By; Created = $item.filedvalue.Created}}

  3. Hi Shane, Great videos are there any updates to this Move SharePoint Online files with Metadata I am working on a migration issue moving folders from a domain share to to One Drive to SharePoint online. Without losing current metadata. I need to get the folders and files moved with their current create dates in tact. Does this Powershell script function like that?

  4. Hi  I am trying to update the new page layouts within the existing Old page layouts inside the multiple pages in site collection. Is that Possible that I can do it with PowerShell. need some Guidance Thanks

  5. I think there are some nasty gotchas to when trying to preserve the authors (Modified by and Created by) – especially when moving across site collections – would be cool to see that covered. Also, when moving files from a file share up into SharePoint – would be interested if there's a PowerShell-only way to extract author property off of Office docs and get that set into the SharePoint author fields.

  6. Hi Shane! are you aware if Drag&drop feature can be disabled using PowerShell and if this can be limited to folders only?

  7. Hi Shane great video. Don't use SharePoint online but its always great to learn it. Just a question have you tried putting your "Copy-PnPFile" as a variable and then seeing if it returns an object?

    Much like:
    $db = New-SPContentDatabase

  8. Shane, I'm trying to copy files from Sharepoint Online to my local machine or network share. Copy-PnPFile seems to only copy from sharepoint library to another library. Do you have any advice? Thank you for the videos!


Please enter your comment!
Please enter your name here