Disable Page Comments: SP Online

Requirement: SharePoint Online has awesome feature at every modern page called “Comment Section” which usually displayed at bottom of the page for better collaboration. My client has requested that they do not want to provide this option to their users. So requirement Disable page comments in SharePoint Online Modern Sites and Communication sites.


  • Option 1: Disable Comments at the tenant level

Page comments can be turned-off at tenant level by the below settings:

  1. Navigate to SharePoint Online Admin Center: https://yourdomain-admin.sharepoint.com 
  2. Click on Settings from left navigation
  3. On the Settings page, Select “Disable Comments on Site Pages.”
  4. Click OK to save your changes.

Wait for a while, the comments section disabled from all pages in the tenant. You can disable comments on modern pages at tenant level using PowerShell as well:

#Connect to SharePoint Online
Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential) 
#Disable Comments on Site Pages at Tenant Level
Set-SPOTenant -CommentsOnSitePagesDisabled $True
  • Option 2: Disable Comments at the Page Level 

Comments can be disabled at page level. Here is how:

  • Navigate to the SharePoint Online Site page >>  Edit the page.
  • Turn off the comments by toggle the switch from ON to OFF position and Publish the page.

This disables comments section in the particular page.

  • Option 3: Disable Comments in SharePoint Online Pages using PowerShell

This PowerShell script disables the page comments for given site.

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Config Parameters
Try {
    #Get Credentials to connect
    $Cred= Get-Credential
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
    #Get the Web
    $Web = $ctx.Web
    #Disable Comments in Site Pages
    $Web.CommentsOnSitePagesDisabled = $True
    Write-host -f Green "Page Comments has been disabled Successfully!"
Catch {
    write-host -f Red "Error:" $_.Exception.Message

Please note, disabling comments doesn’t delete existing comments on pages. It just hides them. Turning ON comments brings the comments back!

PnP PowerShell to Disable Comments on All Pages in a Library

$SiteURL= "https://crescent.sharepoint.com/sites/marketing/2018"
$LibraryName = "SitePages"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Get all Pages from the Library
$Pages = Get-PnPListItem -List $LibraryName
#Loop through each Page
ForEach($Page in $Pages)
    #Disable Comments
    Write-host "Disabling Commnets on page:"$Page["FileLeafRef"]
    Set-PnPClientSidePage -Identity $Page["FileLeafRef"] -CommentsEnabled:$False

Do not forget to hit like in case you find this blog stuff helpful. Happy SharePointing !!!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.