Home >Tips >Introduction to PnP Generator kalmstrom.com site map icon Site map  

Create a SharePoint Site Template with the PnP Generator

A kalmstrom.com Tools tutorial

PowerShell iconWhen 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.
Apply custom site template
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.
  1. In the kalmstrom.com PnP List Generator, enter the name of a content type group. It can be a new or an existing group.
  2. Enter the URL to any SharePoint site within the tenant.
  3. Keep the default SharePoint Online version. The other versions do not support site template scripts.
  4. Keep the default PowerShell version 7. It is not possible to use version 5 for site template creation this way.
  5. Select Parent content type.
  6. Enter the name of the new content type you want to create.
  7. Enter the name of the new list.
  8. Do not use the three checkboxes. They don't work for site templates.
  9. Enter the names of the site columns and specify the column types and other properties.
  10. 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.
  11. Run Visual Studio Code as an administrator.
  12. Open a new script and paste the PowerShell code you copied from the PnP Generator.
  13. Make any changes you prefer to the script.
  14. Run the script to create the site template.
  15. 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.




Products Buy FAQ Services Tips Books Contact About Us Tools

Security and integrity

Copyright  Kalmstrom Enterprises AB  All rights reserved