GitHub Icon Image
GitHub

Disable SharePoint List Commenting at tenant level

Summary

This sample script shows how to disable commenting feature in SharePoint online lists at tenant level.

Scenario inspired from this blog post: How to Enable/Disable the commenting in SharePoint Online/Microsoft Lists

Outupt Screenshot

  • SPO Management Shell
  • PnP PowerShell
  • CLI for Microsoft 365

# SharePoint online admin site url
$siteUrl = "https://<tenant>-admin.sharepoint.com/"	

# Connect to SharePoint Online site
Connect-SPOService -Url $siteUrl

# To disable comments on list items
Set-SPOTenant -CommentsOnListItemsDisabled $true

# To enable comments on list items
Set-SPOTenant -CommentsOnListItemsDisabled $false

Check out the SPO Management Shell to learn more at: Introduction SharePoint Online Management Shell | Microsoft Docs


# SharePoint online admin site url
$siteUrl = "https://<tenant>-admin.sharepoint.com/"	

# Connect to SharePoint Online site
Connect-PnPOnline -Url $siteUrl -Interactive

# To disable comments on list items
Set-PnPTenant -CommentsOnListItemsDisabled $true

# To enable comments on list items
Set-PnPTenant -CommentsOnListItemsDisabled $false

Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell

The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?


# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
   m365 login
}

# To disable comments on list items
m365 spo tenant settings set --CommentsOnListItemsDisabled true

# To enable comments on list items
m365 spo tenant settings set --CommentsOnListItemsDisabled false

Check out the CLI for Microsoft 365 to learn more at: https://aka.ms/cli-m365

Important changes coming to the way you login into CLI for Microsoft 365 (effective 9th September 2024) see Changes in PnP Management Shell registration in Microsoft 365

Contributors

Author(s)
Ganesh Sanap

Disclaimer

THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

Back to top Script Samples
Generated by DocFX with Material UI