Skip to content

Fix #3710 - Improve detection of modern site pages library #3713

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed `Get-PnPFlow` cmdlet to use the newer Flow URLs instead of the old ARM URLs. [#3677](https://github.com/pnp/powershell/pull/3677)
- Fixed `Get-PnPPowerPlatformConnector`, `Get-PnPPowerPlatformEnvironment`, `Get-PnPPowerApp`, `Add-PnPFlowOwner`, `Disable-PnPFlow`, `Enable-PnPFlow`, `Export-PnPFlow`, `Get-PnPFlowOwner`, `Get-PnPFlowRun`, `Remove-PnPFlow`, `Remove-PnPFlowOwner` , `Restart-PnPFlow` and `Stop-PnPFlowRun` cmdlets to use the new HTTP endpoints. [#3687](https://github.com/pnp/powershell/pull/3687)
- Fixed `Add-PnPHubSiteAssociation` cmdlet to allow support for multi-geo scenario. [#3568](https://github.com/pnp/powershell/pull/3568)
- Fixed `Enable/Disable-PnPPageScheduling` cmdlet to also work with Viva connections enabled site.

### Changed

Expand Down
5 changes: 3 additions & 2 deletions src/Commands/Utilities/PagesUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ namespace PnP.PowerShell.Commands.Utilities
internal static class PagesUtility
{
private static readonly Expression<Func<IList, object>>[] getPagesLibraryExpression = new Expression<Func<IList, object>>[] {p => p.Title, p => p.TemplateType, p => p.Id,
p => p.RootFolder.QueryProperties(p => p.Properties, p => p.ServerRelativeUrl), p => p.Fields };
p => p.RootFolder.QueryProperties(p => p.Properties, p => p.ServerRelativeUrl), p => p.Fields, p => p.ListItemEntityTypeFullName };
internal static IList GetModernPagesLibrary(IWeb web)
{
IList pagesLibrary = null;
var libraries = web.Lists.QueryProperties(getPagesLibraryExpression)
.Where(p => p.TemplateType == ListTemplateType.WebPageLibrary)
.Where(p => p.ListItemEntityTypeFullName == "SP.Data.SitePagesItem")
.ToListAsync()
.GetAwaiter().GetResult();

Expand All @@ -27,7 +28,7 @@ internal static IList GetModernPagesLibrary(IWeb web)
{
foreach (var list in libraries)
{
if (list.IsPropertyAvailable(p => p.Fields) && list.Fields.AsRequested().FirstOrDefault(p => p.InternalName == "CanvasContent1") != null)
if (list.ListItemEntityTypeFullName == "SP.Data.SitePagesItem" && list.IsPropertyAvailable(p => p.Fields) && list.Fields.AsRequested().FirstOrDefault(p => p.InternalName == "CanvasContent1") != null)
{
pagesLibrary = list;
break;
Expand Down