Forum Discussion

chiragcanada2020's avatar
chiragcanada2020
Copper Contributor
Nov 23, 2021
Solved

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

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 

  • 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-engine

     

    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"

2 Replies

  • 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-engine

     

    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"

Resources