powershell: [BUG] Cannot work with classic web part, classic wiki, or modern pages on STS#0 sites

Reporting an Issue or Missing Feature

On a site using template STS#0, for a sample classic page named “classic.aspx”, running:

  • ConvertTo-PnPPage -Identity 'classic.aspx' errors with “Could not find file ‘PnP.Framework.resources’”
  • Get-PnPPage -Identity 'classic' errors with “Page ‘classic.aspx’ does not exist”, and same error message for classic and wiki pages

Additionally:

  • Get-PnPListItem -List 'SitePages' and Get-PnPListItem -List 'Site Pages' return nothing, despite there being pages in the library
  • $pagesFolder = Get-PnPFolder -Url 'SitePages' -Includes Files results in $pagesFolder.ItemCount equal to the total number pages in the library, but $pagesFolder.Files will not have any objects, and $pagesFolder.Files.Count will be 0

Ran out of ideas trying to query the Site Pages library, and didn’t bother trying any of the page-related Add-* cmdlets.

Expected behavior

Cmdlets should work similarly to how they work on sites that aren’t using the STS#0 template

Actual behavior

Aforementioned

Steps to reproduce behavior

Aforementioned

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

PnP.PowerShell 1.2.0 Windows PowerShell 5.1 and PowerShell 7.1.0

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

Have not tested outside of Windows

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 30 (9 by maintainers)

Most upvoted comments

Hi,

I just checked the exact scenario you’re describing with version 1.2.0 but do not run into problems:

image

Notice that if you do not specify any other parameters on ConvertTo-PnPPage the file name be prefixed with “Migrated_”.

Also, the other issues you describe work here as intended:

image

Especially the error messages that it cannot find the resources trigger me to think that something is wrong with the installation. Have you tried to uninstall it all and reinstall it?

Uninstall-Module -Name PnP.PowerShell -AllVersions -Force
Install-Module -Name PnP.PowerShell

As last question: which way of connecting do you use? -UseWebLogin / -Credentials / -ClientId-Certificate?

Finally had some time to test with 1.3.0, and everything looks great. Thanks, everyone.

@joshtransient : Get-PnPPage only works for modern pages, so not sure if you’re loading a modern one or not? The error you mention has been fixed already, you can either use a nightly build or wait for a the next official release