Forum Discussion
Sharepoint Online Templates / Provisioning.
Hello everyone,
I have a SharePoint online site that is as close as possible to being a template for my tenant. I'd like to save this site and make it available to me when I need to create a standard site for my tenant.
Do you know if there is a possibility to save it and then pick it in the SharePoint list of templates in the creation phase in SharePoint?
I know there is a PnP solution; however, after trying it I've had some bad results when trying to use a script with
Get-PnPSiteTemplate many times it doesn't replicate the site correctly.
I essentially need to take one SharePoint site, and just replicate the structure, DLs, Lists, Views, pages, designs, colours and thumbnails, no files needed.
Possibly saving it as a template, but if not possible, just provision it via PnP PowerShell would be enough.
Do you have any suggestions or scripts to recommend, or can you point me to any resources?
7 Replies
- Maverick1812Copper Contributor
Thank you for the reply, very much appreciated. I managed to write a script that does work; however, for some reason, it doesn't copy the homepage, so it copies the structure, views, contents, but not the pages and the site design.
#SOURCE $sourceSiteUrl = "Source Site.com" #TARGET $targetSiteUrl = "Targetsite.com" #connect to source site Connect-PnPOnline -Url $sourceSiteUrl -ClientId xxxxxx-xxxxx-xxxxxxxxx -Interactive #Export site template Get-PnPSiteTemplate -Out "NewtestSiteTemplate.xml" -Handlers Pages, Navigation ` -IncludeAllClientSidePages ` -PersistBrandingFiles #connect to target site Connect-PnPOnline -Url $targetSiteUrl -ClientId xxxxxx-xxxxx-xxxxxxxxx -Interactive # System lists/libraries that should be skipped when checking/creating lists $systemLists = @( "Site Pages", "Documents", "AppData", "User Information List", "Master Page Gallery", "Style Library", "Theme Gallery", "Solution Gallery", "TaxonomyHiddenList", "Web Part Gallery" ) #existing list check Get-PnPList | ForEach-Object { if ($systemLists -contains $_.Title) { Write-Host "Skipping system list: $($_.Title)" -ForegroundColor Yellow } else { Write-Host "List exists (non-system): $($_.Title)" -ForegroundColor Green } } # The -ClearNavigation flag resets existing navigation before applying navigation from the template. Invoke-PnPSiteTemplate -Path "NewtestSiteTemplate.xml" -ClearNavigation # Set the home page (default page) on TARGET Set-PnPHomePage -RootFolderRelativeUrl "SitePages/CollabHome.aspx"- Jorge Sottomaior BragaCopper Contributor
Shouldn't you use PNP(instead of XML) as export to get images and stuff?
- Maverick1812Copper Contributor
I honestly don't know, you thinkl I should just modify the output file extension?
- virendrakIron Contributor
I’d be happy to share my experience. We developed custom SharePoint Online provisioning framework approximately four years ago, based on our organizational use cases. It’s a fully script-driven model that enables consistent, scalable site creation and configuration. Key components include:
- CSV-Driven Configuration: Each provisioning activity is driven by structured CSV files, which define the configuration, schema and inputs. Custom PS Scripts read these files to dynamically build or configure the site components.
- Site Creation: Sites are provisioned using SharePoint OOTB templates and are associated with Microsoft 365 groups. All provisioned sites are associated with a designated Hub Site, to inherit the theme, color, navigation.
- Metadata Architecture:
- The Global Term Store is leveraged for taxonomy for enterprise-wide metadata reuse
- Global site columns and content types are defined centrally in the Content Type Hub for tenant-wide reuse.
- Local site columns and content types are created based on specific business needs.
- List and library-level columns are added dynamically to support unique metadata requirements.
- List and Library Provisioning: Lists and libraries are created with attached global content types and local site columns, list/library level columns
- Permission Model:
- Custom permission levels are defined and scripted.
- Library-level permissions are assigned (if applicable)
This model has enabled us to streamline site deployment and support repeatable, scalable provisioning across our tenant.
Please refer to below URLs for your use case:
Export and Import SharePoint Online Site as Template using PowerShell
Auto-configuring SharePoint Sites with Site Templates — The Setup from Start to Finish