Troubleshooting PnP template

When using Plumsail Actions for provisioning templates to SharePoint sites, you may get not the result you expected or ecnounter unknown errors. In this case, the general recommendation is to try provisioning of the same template through PowerShell. If it works properly, most likely the issue is on the side of Plumsail and in this case, contact us at support@plumsail.com. But if the issue persists, the template itself may cause it. To find out what is going wrong, follow the steps below. For better understaning of the general picture, they includes prerequisites and the process of getting a template.

Prerequisites

Creating and troubleshooting PnP templates requires a PnP PowerShell module. To install it, run PowerShell as administrator and perform the command:

Install-Module PnP.PowerShell

To update the existing module, use another one:

Update-Module PnP.PowerShell

Get template

Connect to a source site:

Connect-PnPOnline -Url "https://contoso.sharepoint.com/sites/template-site"

Plumsail Actions require the PnP provisioning schema of version V202002 or earlier. Thus, when getting a template, specify it as per below:

Get-PnPSiteTemplate -Out template.xml -Schema V202002

Note

You need to use PowerShell 7 to perform the module’s cmdlets.

Troubleshoot template

Connect to the site to which you want to apply the template:

Connect-PnPOnline -Url "https://contoso.sharepoint.com/sites/my-site"

Turn on log tracing. With the command below you can capture the debug events and save them to a text file in the current directory.

Set-PnPTraceLog -On -LogFile traceoutput.txt -Level Debug

Then, apply the site template:

Invoke-PnPSiteTemplate -Path template.xml

Open the file traceoutput.txt and search for [Error] records. They occur after failed provisioning steps. Some error messages are clear and help in solving their cause, and some not. But leastwise, you will know on what step the process failed:

logs-error

After that, you can either delete the problem element from the template or change it on the source site and get another version of the template.

template-part