Create a SharePoint Site Template with the PnP Generator
A kalmstrom.com Tools tutorial
When
Site owners use the 'Apply a site template' command in a
modern SharePoint site and select one of the built-in site
templates, the site's existing content will be kept but
the homepage will be the one that the template creates.
These templates also add other content to the site.
When you as a SharePoint Admin create a custom site template,
you can specify exactly which content the template should
add to the site. Such custom site templates are created
using JSON and PowerShell.
If your PowerShell knowledge is limited, you can still create
a site template that adds a custom list to all sites where
it is applied. Welcome to use the free
kalmstrom.com SharePoint PnP List Generator. The
generator creates site templates for Communication sites
and modern Team sites with and without a group.
The templates are stored centrally and available to the
whole organization via the 'From your organization' tab
in the 'Select a template' dialog. When a user selects the
template, the new list will be added to the site in a few
seconds.
The generator builds a PowerShell site script from the data
you enter in the generator form. Paste the script in Visual
Studio Code and run the script to create the template. Currently,
only SharePoint Online and PowerShell V7 are supported.
If you want to try the tool, you can use the example data.
That is what Peter does in the demo, but the steps below
describe how you create your own site template.
- In the kalmstrom.com PnP List Generator, enter the
name of a content type group. It can be a new or an
existing group.
- Enter the URL to any SharePoint site within the
tenant.
- Keep the default SharePoint Online version. The
other versions do not support site template scripts.
- Keep the default PowerShell version 7. It is not
possible to use version 5 for site template creation
this way.
- Select Parent content type.
- Enter the name of the new content type you want
to create.
- Enter the name of the new list.
- Do not use the three checkboxes. They don't work
for site templates.
- Enter the names of the site columns and specify
the column types and other properties.
- Copy the PowerShell code. NOTE that you need to
select all code and copy it via right-click. The 'Copy
to clipboard' button currently does not work for site
templates.
- Run Visual Studio Code as an administrator.
- Open a new script and paste the PowerShell code
you copied from the PnP Generator.
- Make any changes you prefer to the script.
- Run the script to create the site template.
- To verify, open any site, click on Settings >Apply
a site template >From your organization and make
sure that the new template is there. Under Recommended,
you will see the template version for the current site
type. The other two versions are found under More templates.
|