pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
990 stars 663 forks source link

PnP-ApplyProvisioningTemplate cannot find file #2223

Open PathToSharePoint opened 5 years ago

PathToSharePoint commented 5 years ago

Notice: many issues / bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:

2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue?**** I suspect it is.

Reporting an Issue or Missing Feature

Issue

Expected behavior

I am storing the .pnp template in a SharePoint library. The PnP-ApplyProvisioningTemplate should find it based on the path entered under -Path.

Actual behavior

Everything works as expected when the file is placed directly under the root of the library. If however the file is inside a folder in the library, PnP doesn't find it.

Steps to reproduce behavior

Upload the PnP template to a channel in Microsoft Teams. Get the link to the template and use it in the -Path value. The typical path would be: "https://tenant.sharepoint.com/sites/TeamName/Shared%20Documents/ChannelName/Template.pnp"

Which version of the PnP-PowerShell Cmdlets are you using?

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name *pnppowershell* -ListAvailable) Not sure, it says 3.12.19 and 3.4.1812.0

How did you install the PnP-PowerShell Cmdlets?

ghost commented 5 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

garrytrinder commented 5 years ago

Just tested this on 3.12.1908.1 (dev)

PS > Apply-PnPProvisioningTemplate -Path https://tenant.sharepoint.com/sites/team/Shared%20Documents/TemplatesChannel/template.pnp

results in this error

Apply-PnPProvisioningTemplate : Object reference not set to an instance of an object.
At line:1 char:1
+ Apply-PnPProvisioningTemplate -Path https://tenant.sharepoint.com/s ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Apply-PnPProvisioningTemplate], NullReferenceException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate

Also tested from a Modern Site with No Group (STS#3), works fine when template is stored in a folder in Shared Documents library.