I can easily see that from the UI, there are "copy to" and "move to" options for Libraries. But I would like to use PowerShell to copy an entire library from one site to another site, so that when I preview the new site, the library is setup with the same library title, and URL name that was provided from the original library.



//kitchen-library copies to...


//and becomes...

//and all the original kitchen-library files are copied here too

Is this this possible today via Powershell?

1 Answer 1


We recommend that you use SharePoint Online OOB to implement your design.

Please following steps:

1.Go to the source Document library as an admin >> Library settings >> (General Settings) Save document library as template

2.On the Save as Template page, please select "Include Content" option

enter image description here

3.When you click list template gallery, you can see the library template you just created.

enter image description here

4.Select this template and click on Download a Copy under the FILES tab

enter image description here

5.Go to the destination Site Settings page >> (Web Designer Galleries) List templates

6.Click on Upload Document under the FILES tab, upload the template file just downloaded.

enter image description here

7.Then, go to Site contents page(classic mode). Click add an app, in the "Find an app" searchbox, entry template name.

enter image description here

8.Create a name for your new Document library. You will find that the source Document library is completely copied to the new Document library.

enter image description here

============================== Updated Answer ===============================

If you cannot see Save documnet library/list as template in SharePoint, please enable custom script feature.

Please run the below PowerShell command as an admin:

$TenantURL = "https://tenant-admin.sharePoint.com"
$SiteURL ="https://tenant.sharepoint.com/sites/yoursite"
$username = "[email protected]"
$cred = Get-Credential -UserName $username -Message "Type the password:"
Connect-SPOService -URL $TenantURL -Credential $cred 
Set-SPOSite -Identity $SiteURL -DenyAddAndCustomizePages $False

Here is a similar case for your reference:

  • much appreciated for all the detailed steps! I'll try this out in the next hour.
    – klewis
    May 13, 2021 at 12:12
  • ah! I don't have enough access authority to be top admin for this library, even though I created it from scratch and I'm the owner. The link to save as template just isn't there. Sucks.
    – klewis
    May 13, 2021 at 12:55
  • Hi, klewis. I have updated answer under initial My Answer. Hope this can help you to solve issue. Have a nice day! May 14, 2021 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.