How to Debug the OfficeDev PnP Provisioning Engine

Pieter Veenstra

by Pieter Veenstra on 8/2/2016

Share this:
Print

Article Details

Date Revised:
8/2/2016

Applies to:
debugging, Office 365 PnP Partner Pack, OfficeDev PnP, PowerShell


Turn your debugger on in PowerShell to help!

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

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

Since OfficeDev PnP 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 I’ll switch on the debug for my PowerShell

Set-SPOTraceLog -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

This now returns the additional information that you need:

With debugging turned on in PowerShell, you can see fields, content types or lists causing problems
With debugging turned on in PowerShell, you can see fields, content types or lists causing problems

So when an export or import (with Apply-ProvisioningTemplate) 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.

You can find Pieter’s original blog plus other great tips here: https://veenstra.me.uk/2016/07/29/office-365-sharepoint-how-to-debug-pnp-provisioning-engine/


Topic: Development

Sign in with

Or register