Forum Discussion
Sylvester-
Aug 05, 2020Brass Contributor
Create SharePoint Online site based on .wsp template file via PowerShell
Dear community, I am trying to find the quickest solution to provision new SharePoint sites based on a template site (we extracted the .wsp file). Currently we manually create a SharePoint site v...
Matti Paukkonen
Aug 05, 2020Iron Contributor
Hi Sylvester-,
Is it required to use wsp-file approach? What features are required to be provisioned from that template?
Better option would be to use PnP PowerShell to get a template out of your template site and applying it to a newly created site. PnP template can be exported to an XML file.
To get a template to an XML with PnP PowerShell
Connect-PnPOnline -Url <your template site url> -UseWebLogin
Get-PnPProvisioningTemplate -Out <path to xml-file>You can use Handlers to limit out features you want to be included.
Applying a template to a new site
Connect-PnPOnline -url <new site url> -UseWebLogin
Apply-PnPProvisioningTemplate -Path <path to template xml-file>
Here is a link to PnP PowerShell documentation https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view=sharepoint-ps
If you need help with PnP templates, please let me know.