PnP-PowerShell icon indicating copy to clipboard operation
PnP-PowerShell copied to clipboard

[BUG] Add-PnPListFoldersToProvisioningTemplate - does not update .pnp file

Open stukkendfc opened this issue 3 years ago • 3 comments

Reporting an Issue or Missing Feature

Add-PnPListFoldersToProvisioningTemplate does not update a .pnp file with the folders in the selected library.

Expected behavior

To update the given Provisioning Template with the folders in the given library.

Actual behavior

Template file is not updated with the folders when the Template file is of type .pnp (e.g. Filename.pnp). Command does add the folder structure if the Template file is of type .xml (e.g. Filename.xml).

When applying the template using .pnp file, no folders are added to the library.

Steps to reproduce behavior

Add-PnPListFoldersToProvisioningTemplate -Path "c:\Templates\SiteTemplate.pnp" -List "List name" -Recursive

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

  • [ ] PnP PowerShell for SharePoint 2013
  • [ ] PnP PowerShell for SharePoint 2016
  • [ ] PnP PowerShell for SharePoint 2019
  • [x ] PnP PowerShell for SharePoint Online

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

3.22.x

How did you install the PnP-PowerShell Cmdlets?

  • [ ] MSI Installed downloaded from GitHub
  • [x ] Installed through the PowerShell Gallery with Install-Module
  • [ ] Other means

stukkendfc avatar Sep 25 '20 13:09 stukkendfc

Can confirm this also exists in version 3.25 in PnP PowerShell for SharePoint 2016

cOberlaender avatar Sep 29 '20 09:09 cOberlaender

I have the same issue om 3.26 however the trace log seems to tell us that the file IS updated but saved to a wrong folder , one level up compared to the source:

I have verified that this file does contain the the folder refs as expected

PS C:\Users\kbl> $t = Add-PnPListFoldersToProvisioningTemplate -Path C:\temp\PnPTemplateTest\PnPTemplateTest.pnp -List "Documents" -Recursive powershell.exe Information: 0 : 2020-11-06 19.51.31.0415 [OfficeDevPnP.Core] [0] [Information] File PnPTemplateTest.pnp retrieved from folder 0ms powershell.exe Information: 0 : 2020-11-06 19.51.31.0498 [OfficeDevPnP.Core] [0] [Information] File PnPTemplateTest.pnp retrieved from folder 0ms powershell.exe Information: 0 : 2020-11-06 19.51.31.1025 [OfficeDevPnP.Core] [0] [Information] File PnPTemplateTest.xml retrieved from folder 0ms powershell.exe Error: 0 : 2020-11-06 19.51.35.1008 [OfficeDevPnP.Core] [0] [Error] File C:\temp\PnPTemplateTest.pnp not found in directory . Exception = Could not find file 'C:\temp\PnPTemplateTest.pnp'. 0ms powershell.exe Information: 0 : 2020-11-06 19.51.35.1886 [OfficeDevPnP.Core] [0] [Information] File PnPTemplateTest.xml saved to folder 0ms powershell.exe Information: 0 : 2020-11-06 19.51.35.2133 [OfficeDevPnP.Core] [0] [Information] File C:\temp\PnPTemplateTest.pnp saved to folder 0ms

kasperbolarsen avatar Nov 06 '20 19:11 kasperbolarsen

We also have the same issue. When seeing the current sourcecode, i guess the problem lies within the following line:

XMLTemplateProvider provider = new XMLOpenXMLTemplateProvider(new OpenXMLConnector(outPath, fileSystemConnector));

of the file AddListFoldersToProvisioningTemplate.cs in the PnP.PowerShell.Core Project (line 106).

In comparison to the same line of the AddDataRowsToProvisioningTemplate.cs file (line 207) it seems obvious, that the path variable is the problem.

XMLTemplateProvider provider = new XMLOpenXMLTemplateProvider(new OpenXMLConnector(Path, fileSystemConnector));

Unfortunatly I am not able to build the project on my system to test the idea. Maybe someone can verify this or help me build the project?

dgoldbachhzd avatar Nov 30 '20 14:11 dgoldbachhzd