Create a SharePoint site using the configuration of another site
This script uses PnP Powershell to extract the template of one SharePoint site and invoke it on another site
Summary
This script uses PnP Powershell to extract the template of one SharePoint site and invoke it on another site. This lets you create sites with all the same lists and configuration as another SharePoint site. Perhaps you want to implement ALM practices around your SharePoint based development? This is a great way to get started!
$ExistingSiteUrl = "https://yourtenant.sharepoint.com/sites/yourexistingsite"
$SiteTemplateFile = "\Template.xml"
Connect-PnPOnline -Url $ExistingSiteUrl -PnPManagementShell
Get-PnPSiteTemplate -Out $SiteTemplateFile
$TargetSiteUrl = "https://yourtenant.sharepoint.com/sites/yourtargetsite"
Connect-PnPOnline -Url $TargetSiteUrl -PnPManagementShell
Invoke-PnPSiteTemplate -Path $SiteTemplateFile
Source Credit
Understand more about this script by reading this Microsoft 365 Platform Community Blog post - Creating a SharePoint site using the configuration of another site with PnP Powershell
Contributors
| Author(s) |
|---|
| Lewis Baybutt |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
Tool documentation & references
- Want to learn more about PnP PowerShell and the cmdlets
Check out the PnP PowerShell site to get started and for the reference to the cmdlets.