pnp / pnpcore

The PnP Core SDK is a modern .NET SDK designed to work for Microsoft 365. It provides a unified object model for working with SharePoint Online and Teams which is agnostic to the underlying API's being called
https://aka.ms/pnp/coresdk/docs
MIT License
303 stars 194 forks source link

Get-PnPPage always uses first page library #333

Closed matthiasirx closed 3 years ago

matthiasirx commented 3 years ago

Category

Describe the bug

In a site with multiple page libraries, all page related cmdlets (Get-PnpPage, Export-PnPPage, ...) always use the (alphabetically?) first library. I was able to trace this back to this commit: https://github.com/pnp/pnpcore/commit/dd43f2fa1943495449c0e517419666cc5049e45d

In my case I have a page library "Classic Pages" and the default "Site Pages". Get-PnPPage Home.aspx fails since it is looking at Classic Pages library. Same with Get-PnPPage SitePages/Home.aspx

Steps to reproduce

Create a second page library "Classic Pages".

Expected behavior

It should be possible to specify which page library is used.

Environment details (development & target environment)

PnP.PowerShell 1.3.0 Windows 10 PowerShell 5

jansenbe commented 3 years ago

@matthiasirx : the modern page API only supports modern pages and modern pages only live in a single SitePages library per site. I think you're referring to classic pages (wiki, web part, publishing). You can consider modernizing these classic pages into modern pages, see https://aka.ms/sharepoint/modernization/pages

matthiasirx commented 3 years ago

@jansenbe Indeed the second library is for classic wiki pages, which cannot be converted for the time being. But with those two page libraries within the same site, the pages api selects the wrong library, so I can't use the Page cmdlets anymore. Add-PnPPage even creates the pages in the wrong library and then fails with an error afterwards.

jansenbe commented 3 years ago

@matthiasirx : you're right, the wiki page library and site pages library are of the same type, so having a wiki page library might result in the modern page API picking the wrong library. Flagged as bug which I'll tackle once we're done with a fairly big refactoring

jansenbe commented 3 years ago

@matthiasirx : just fixed this issue, next nightly should correctly identify the site pages library