How to copy existing SharePoint Online Prod site with contents same to same for DEV site?

%3CLINGO-SUB%20id%3D%22lingo-sub-2998100%22%20slang%3D%22en-US%22%3EHow%20to%20copy%20existing%20SharePoint%20Online%20Prod%20site%20with%20contents%20same%20to%20same%20for%20DEV%20site%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2998100%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20requirement%20to%20mimic%20exactly%20as%20is%20as%20the%20SharePoint%20online%20Prod%20site%20with%20contents%20and%20permissions%20and%20create%20a%20new%20DEV%20site.%20How%20can%20I%20achieve%20that%3F%20Please%20help%20to%20get%20some%20pointers%20or%20scripts.%20This%20is%20in%20SharePoint%20online.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EChirag%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2998100%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2998190%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20copy%20existing%20SharePoint%20Online%20Prod%20site%20with%20contents%20same%20to%20same%20for%20DEV%20site%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2998190%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1031832%22%20target%3D%22_blank%22%3E%40chiragcanada2020%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20use%20PnP%20Powershell%20to%20create%20a%20site%20template%20which%20you%20can%20apply%20to%20the%20DEV%20site.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsolution-guidance%2Fintroducing-the-pnp-provisioning-engine%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsolution-guidance%2Fintroducing-the-pnp-provisioning-engine%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECode%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%23%20connect%20to%20the%20prod%20site%0AConnect-PnPOnline%20-Url%20%22https%3A%2F%2Fyourtenant.sharepoint.com%2Fsites%2Fprod%22%0A%0A%23%20get%20the%20template%0AGet-PnPSiteTemplate%20-Out%20%22PnP-Provisioning-File.xml%22%0A%0A%23%20connect%20to%20the%20dev%20site%0AConnect-PnPOnline%20-Url%20%22https%3A%2F%2Fyourtenant.sharepoint.com%2Fsites%2Fdev%22%0A%0A%23%20apply%20the%20template%0AInvoke-PnPSiteTemplate%20-Path%20%22PnP-Provisioning-File.xml%22%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello,

 

I have a requirement to mimic exactly as is as the SharePoint online Prod site with contents and permissions and create a new DEV site. How can I achieve that? Please help to get some pointers or scripts. This is in SharePoint online.

 

Thanks,

Chirag 

1 Reply

@chiragcanada2020 

 

You can use PnP Powershell to create a site template which you can apply to the DEV site.

https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/introducing-the-pnp-provisioning-e...

 

Code:

 

# connect to the prod site
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/prod"

# get the template
Get-PnPSiteTemplate -Out "PnP-Provisioning-File.xml"

# connect to the dev site
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/dev"

# apply the template
Invoke-PnPSiteTemplate -Path "PnP-Provisioning-File.xml"