pnp / PnP-PowerShell

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

Save-PnPProvisioningTemplate - Cannot save to .pnp package #2756

Open daniel-pfaeffli opened 4 years ago

daniel-pfaeffli commented 4 years ago

Reporting an Issue or Missing Feature

Issue

Expected behavior

Save pnp template as .pnp package should work according to documentation https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/save-pnpprovisioningtemplate?view=sharepoint-ps

Actual behavior

`$template =Read-PnPProvisioningTemplate -Path C:\Temp\pnpprovisioning\ExtractedFromSite.xml Save-PnPProvisioningTemplate -Template $temp2 -Out c:\temp\newtemplate.pnp Save-PnPProvisioningTemplate : Illegal characters in path. At line:1 char:1

Steps to reproduce behavior

  1. Create a simple provisioing template or extract from site
  2. Read Template and save to variable $template =Read-PnPProvisioningTemplate -Path C:\Temp\pnpprovisioning\ExtractedFromSite.xml
  3. Save template to a .pnp file Save-PnPProvisioningTemplate -Template $template -Out c:\temp\newtemplate.pnp

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

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

3.22.2006.2

How did you install the PnP-PowerShell Cmdlets?

ghost commented 4 years ago

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

erwinvanhunen commented 4 years ago

Hi!

During the creation of the .pnp file we try to read all referenced file resources and add them to the PnP file (it's effectively a zip file with metadata).

Can you try this:

$template = Read-PnPProvisioningTemplate -Path yourtemplate.xml
Save-PnPProvisioningTemplate -Template $template -Out yourfile.pnp

If the second step fails, please check the validity of the file references in your template.