Skip to content

Commit 116fa61

Browse files
gautamdshethGautam Sheth
and
Gautam Sheth
authored
Fix #3710 - Improve detection of modern site pages library (#3713)
Co-authored-by: Gautam Sheth <gautam.sheth@staffbase.com>
1 parent a4b4a7f commit 116fa61

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
3434
- Fixed `Get-PnPFlow` cmdlet to use the newer Flow URLs instead of the old ARM URLs. [#3677](https://github.com/pnp/powershell/pull/3677)
3535
- 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)
3636
- Fixed `Add-PnPHubSiteAssociation` cmdlet to allow support for multi-geo scenario. [#3568](https://github.com/pnp/powershell/pull/3568)
37+
- Fixed `Enable/Disable-PnPPageScheduling` cmdlet to also work with Viva connections enabled site.
3738

3839
### Changed
3940

src/Commands/Utilities/PagesUtility.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ namespace PnP.PowerShell.Commands.Utilities
1010
internal static class PagesUtility
1111
{
1212
private static readonly Expression<Func<IList, object>>[] getPagesLibraryExpression = new Expression<Func<IList, object>>[] {p => p.Title, p => p.TemplateType, p => p.Id,
13-
p => p.RootFolder.QueryProperties(p => p.Properties, p => p.ServerRelativeUrl), p => p.Fields };
13+
p => p.RootFolder.QueryProperties(p => p.Properties, p => p.ServerRelativeUrl), p => p.Fields, p => p.ListItemEntityTypeFullName };
1414
internal static IList GetModernPagesLibrary(IWeb web)
1515
{
1616
IList pagesLibrary = null;
1717
var libraries = web.Lists.QueryProperties(getPagesLibraryExpression)
1818
.Where(p => p.TemplateType == ListTemplateType.WebPageLibrary)
19+
.Where(p => p.ListItemEntityTypeFullName == "SP.Data.SitePagesItem")
1920
.ToListAsync()
2021
.GetAwaiter().GetResult();
2122

@@ -27,7 +28,7 @@ internal static IList GetModernPagesLibrary(IWeb web)
2728
{
2829
foreach (var list in libraries)
2930
{
30-
if (list.IsPropertyAvailable(p => p.Fields) && list.Fields.AsRequested().FirstOrDefault(p => p.InternalName == "CanvasContent1") != null)
31+
if (list.ListItemEntityTypeFullName == "SP.Data.SitePagesItem" && list.IsPropertyAvailable(p => p.Fields) && list.Fields.AsRequested().FirstOrDefault(p => p.InternalName == "CanvasContent1") != null)
3132
{
3233
pagesLibrary = list;
3334
break;

0 commit comments

Comments
 (0)