-
Notifications
You must be signed in to change notification settings - Fork 388
Description
Reporting an Issue or Missing Feature
Set-PnPPage -Identity {PAGE} -CommentsEnabled:$false sets ALL pages to layout type of "Article".
Expected behavior
A) If the -LayoutType switch is omitted, it should NOT change the layout.
B) OR if the -LayoutType switch must be processed every time, then it should be a REQUIRED field in cmdlet AND there should be no default. That may help draw attention to the importance of setting each page explicitly.
Actual behavior
All pages are set to "Article" when the -LayoutType switch is omitted. The page header bar then shows up on all pages, including the Home page.
Steps to reproduce behavior
$pages = Get-PnPListItem -List "Site Pages" -IncludeContentType | Where-Object -FilterScript { $_.ContentType.Name -in 'Site Page','Repost Page' }
foreach ($page in $pages) {
Set-PnPPage -Identity $page.FieldValues.FileLeafRef -CommentsEnabled:$false
}
The goal was to turn off all page comments. This worked, however the unintended result was this also pulls in "Home.aspx", which is layout type of "Home" and sets it to "Article". The work-around was to run this.
Set-PnPPage -Identity 'Home.aspx' -CommentsEnabled:$false -LayoutType Home
What is the version of the Cmdlet module you are running?
2.3.56
Which operating system/environment are you running PnP PowerShell on?
- Windows
- Linux
- MacOS
- Azure Cloud Shell
- Azure Functions
- Other : please specify