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
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
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
Get-PnPProvisioningTemplate -Handler Fields -Out c:\temp\test.xml
This now returns the additional information that you need:
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/
One thought on “Office 365 – SharePoint – How to debug PnP Provisioning Engine”
[…] It often is useful to get some additional information. See my post http://veenstra.me.uk/2016/07/29/office-365-sharepoint-how-to-debug-pnp-provisioning-engine/ […]