In modern SharePoint site, comments are shown at the bottom of modern site pages where user can add feedback related to the content on the page. Comments can be disabled at the tenant level for all the sites or a page editor can also enable/disable comments on a page by simply edit the page.

Delete comments from Site Pages library

Users can submit comments on a SharePoint modern page but there is no option for users site owners and submitter to delete or modify the comment.

Page owner can delete this by going to page details and select the three dots to delete all comments on the page as shown in the picture.

PowerShell to delete comments

I have written a small PowerShell cmdlet to delete comments from a page using PnP PowerShell module.

$listName= "Site Pages" 
$itemID = "5"
$comments = Get-PnPListItemComment -List $listName -Identity $itemID

        foreach($comment in $comments)
               Remove-PnPListItemComment -List $listName -Identity $itemID -Text $comment.Text -Force               

Adnan is six time Microsoft MVP (Since 2015) with over 16 years of extensive experience with major expertise on SharePoint, SharePoint based development, Microsoft 365, Microsoft Teams, .Net Platform and Microsoft BI. He is currently working Sr Microsoft Consultant at Olive + Goose. He is MCT Regional Lead for Pakistan Chapter since 2012. He is working on SharePoint for past 12 years and worked on different intranet/intranet solutions for private & govt. sector majorly in United states and Gulf region and have experience of working with multiple Fortune 500 companies. He is a trainer, technology evangelist and also speaks in community forums.

Leave a Reply