Skip to content

Commit

Permalink
Viva Announcement Library resulted in two pages libaries breaking t…
Browse files Browse the repository at this point in the history
…he page library detection logic #1343
  • Loading branch information
jansenbe committed Jan 10, 2024
1 parent cfc5130 commit 0ea1c82
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Admin library: added support to specify the timezone when creating a site collection #1334 [kfircs - Kfir Chen]
- Auth library: default access token retrieval log message to `debug` instead of `information` #1328 [jansenbe - Bert Jansen]
- Viva Announcement Library resulted in two `pages` libaries breaking the page library detection logic #1343 [jansenbe - Bert Jansen]

## [1.11.0]

Expand Down
19 changes: 15 additions & 4 deletions src/sdk/PnP.Core/Model/SharePoint/Pages/Internal/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,18 @@ private static async Task<IList> EnsurePagesLibraryAsync(PnPContext context)
// The site pages library has the CanvasContent1 column, using that to distinguish between Site Pages and other wiki page libraries
if (list.IsPropertyAvailable(p => p.Fields) && list.Fields.AsRequested().FirstOrDefault(p => p.InternalName == "CanvasContent1") != null)
{
if (list.ArePropertiesAvailable(getPagesLibraryExpression))
// Verify this is the "real" pages library, sites supporting Viva Connections have a second pages library (named Announcements) used to
// store Viva Connections announcements
if (list.IsPropertyAvailable(p => p.ListItemEntityTypeFullName) && list.ListItemEntityTypeFullName == "SP.Data.SitePagesItem")
{
pagesLibrary = list;
if (list.ArePropertiesAvailable(getPagesLibraryExpression))
{
pagesLibrary = list;
}

// As there's only one real pages library we can bail out now
break;
}
break;
}
}
}
Expand All @@ -510,7 +517,11 @@ private static async Task<IList> EnsurePagesLibraryAsync(PnPContext context)
{
foreach (var list in libraries)
{
if (list.IsPropertyAvailable(p => p.Fields) && list.Fields.AsRequested().FirstOrDefault(p => p.InternalName == "CanvasContent1") != null)
if (list.IsPropertyAvailable(p => p.Fields) &&
list.Fields.AsRequested().FirstOrDefault(p => p.InternalName == "CanvasContent1") != null &&
// Verify this is the "real" pages library, sites supporting Viva Connections have a second pages library (named Announcements) used to
// store Viva Connections announcements
list.ListItemEntityTypeFullName == "SP.Data.SitePagesItem")
{
pagesLibrary = list;
break;
Expand Down

0 comments on commit 0ea1c82

Please sign in to comment.