How To Enable Or Disable Comments In Modern SharePoint Page Using PnP Powershell

In this blog, we are going to see how to disable or enable comments for the SharePoint Modern Page using PnP PowerShell command.
 
The Set-ClientSidePage command is used to update the property for SharePoint modern Site Page in Site Pages library.

Enable Comments in Modern Page

The below PowerShell command is used to enable the disabled comments property of the modern site page in SharePoint.
  1. PS:> $cred = Get-Credential  
  2. PS:> Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/dev -Credential $cred  
  3. PS:> Set-PnPClientSidePage -Identity “Home Page” -CommentsEnabled  
 
 
By default, a modern page is enabled with comments.

Disable Comments in Modern Page

The below PowerShell command is used to disable the comments from the Site Page in SharePoint. 
  1. PS:> $cred = Get-Credential  
  2. PS:> Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/dev -Credential $cred  
  3. PS:> Set-PnPClientSidePage -Identity “Home Page” -CommentsEnabled:$false  


The above command first checks whether the provided identity is a modern page or not and then, disables the comments of the /SitePages/Home Page.aspx