Quite often I run into issues with PnP templates where something is going wrong but it is unclear what is going wrong. The xml file isn’t generated when I run:

Get-SPOProvisioningTemplate  -Out c:\temp\test.xml

or

Get-PnPProvisioningTemplate  -Out c:\temp\test.xml

 

And yes I may get an error but it would help if I knew where the command fails.  Similar behaviour you might find when you run the Core PnP libraries from your code in an app or any of the other PnP framework related code.

As this is an open source project it is possible to debug using the code. But there is an easier way. Even when I’m running into issues with the Partner pack I simply revert back to PowerShell.

First step, I’m switching the debug for my PowerShell on

Set-SPOTraceLog -On -Level Debug

or

Set-PnPTraceLog -On -Level Debug

For simplicity sake I’m now only going to run the fields handler:

Get-SPOProvisioningTemplate -Handler Fields  -Out c:\temp\test.xml

or

Get-PnPProvisioningTemplate -Handler Fields  -Out c:\temp\test.xml

This now returns the additional information that you need:

PowerShellPnP

So when an export or import (with Apply-PnPProvisioningTemplate) fails you can see which field, content type or list is the cause of the problem. Once you know what is causing the problem it will be easy to identify what is wrong and why the Provisioning Engine is failing.

If you now still need more details and you want to debug the PnP PowerShell Cmdlets themselves then please have a look at https://sharepains.com/2016/10/11/office-365-how-do-debug-pnp-powershell-commands/

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as a Principal Architect at HybrIT Services Ltd. You can contact me using contact@sharepains.com

One thought on “Office 365 – SharePoint – How to debug PnP Provisioning Engine”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue Reading

%d bloggers like this: