powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Unable to export folders from PictureLibrary recursively AND with security using Add-PnPListFoldersToProvisioningTemplate

Open umaknow-william opened this issue 5 years ago • 4 comments

Notice

Many bugs reported are actually related to the PnP Framework which is used behind the scenes. Consider carefully where to report an issue:

  1. Are you using Invoke-PnPSiteTemplate or Get-PnPSiteTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/pnp/pnpframework/issues.
  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? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/pnp/powershell/tree/master/src/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/pnp/pnpframework/issues

Reporting an Issue or Missing Feature

Please confirm what it is that your reporting

  • Issue

Expected behavior

  • When exporting folders from a PictureLibrary using Add-PnPListFoldersToProvisioningTemplate, I would expect to be able to use both the available parameters -Recursive and -IncludeSecurity

Actual behavior

  • When exporting folders from a PictureLibrary using Add-PnPListFoldersToProvisioningTemplate using both the available parameters -Recursive and -IncludeSecurity, and error is throw immediately if any folder is present with contents in the library.

Error:

CommandFailed

Screenshot of PictureLibrary

PictureLibrary

Steps to reproduce behavior

  • Create new SharePoint site
  • Connect-PnPOnline
  • New-PnPList -Title Images -Template PictureLibrary
  • Add a folder to newly created library
  • Place some images in newly created folder
  • Get-PnPProvisioningTemplate
  • Add-PnPListFoldersToProvisioningTemplate -List Images -Recursive -IncludeSecurity

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

  • Issue was first detected in module SharepointPnPPowerShellOnline 3.19.2003.0
  • Tested and still present in PnP.PowerShell 1.7.0

Which operating system/environment are you running PnP PowerShell on?

  • [X] Windows

umaknow-william avatar Oct 01 '21 14:10 umaknow-william

@umaknow-william - what is the current error that you are getting when using the latest module ? The screenshot looks to be from the old module.

gautamdsheth avatar Oct 12 '21 19:10 gautamdsheth

Yes, sorry, the screenshots where taken with an earlier version. Here is a screenshot using the current version, (same process) the behavior is the same, I believe because the code in the C# class is the same

PnPNewVersionError

umaknow-william avatar Oct 13 '21 14:10 umaknow-william

One more question, what is the site template from which you are getting this PnP template? Is it communication site or team site or something else ?

gautamdsheth avatar Oct 13 '21 20:10 gautamdsheth

Communication sites, I haven't tested it with a Team site.

umaknow-william avatar Oct 14 '21 13:10 umaknow-william