Is it possible to retrieve a web template (not a site template) in SharePoint Online?
-
13-02-2021 - |
Question
You can get a site template in SharePoint Online by going to site settings and clicking save as template (it will be stored in the solution gallery).
I have seen articles on how to create custom web templates, but is there a way to generate them for a web that already exists?
Forgive me if this is a silly question. I am still reading up on web templates.
Solution
A web template is persisted in the SharePoint database as a Microsoft SharePoint Foundation Solution, which is a file that has a .wsp
extension. The .wsp
file is stored in the Solutions Gallery of the site collection. The solution can also be deployed as a sandboxed solution.
Users create web templates on the Save as Template page (or through code that uses the SaveAsTemplate method of the Microsoft.SharePoint.SPWeb class).
Source: Web Templates
Issue: Unfortunately, the SaveAsTemplate
method is not available in SharePoint Online.
Solution:
In SharePoint Online, you can use Get-PnPProvisioningTemplate
using PnP PowerShell to generate a provisioning site template from a web.
References: