Apply-PnPProvisioningTemplate error when providing URL to pnp file in SharePoint

Highlighted
Occasional Contributor

I looked at the samples and source code and it does show you can use a SharePoint doc library to hold the XML template as a .pnp file when passing in the -Path parameter, however I am getting an error.

 

Apply-PnPProvisioningTemplate -Path https://my.sharepoint.com/sites/test/template.pnp -Handlers Navigation -ClearNavigation:$true
 
I get this error then:  Object reference not set to an instance of an object
 
It works fine if it is a local file
Has anyone successfully used the Apply-PnPProvisioningTemplate command with a SP URL for the path?
1 Reply
Highlighted

Hi

 

Did you ever get this to work.  I am revisiting some deployment scripts I successfully tested a few months ago  and I am getting the same error - I have created an issue on GIT to follow this up.

 

Apply-PnPProvisioningTemplate : Object reference not set to an instance of an object.
At D:\Dev\Clients\WSL\The Volt SP Starter Kit Non FR\provisioning\Apply-WSLSiteDesignsOrScripts.ps1:69
char:1
+ Apply-PnPProvisioningTemplate -Path WSLProvisioningSDTemplate.xml
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], NullReferenceException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTempl
ate