Disable SharePoint List Commenting at tenant level
This sample script shows how to disable commenting feature in SharePoint online lists 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

# 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
# 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
# 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
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.
Tool documentation & references
- Introduction to the SharePoint Online Management Shell
Check out the SPO Management Shell documentation site to get started and for the reference to the cmdlets.
- Want to learn more about PnP PowerShell and the cmdlets
Check out the PnP PowerShell site to get started and for the reference to the cmdlets.
- Want to learn more about CLI for Microsoft 365 and the commands
Check out the CLI for Microsoft 365 site to get started and for the reference to the commands.