Create a SharePoint site using the configuration of 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
Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell
The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?
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.