In a SharePoint modern page, you as an author would be able to turn on or turn off comments while creating a page. Everyone with minimum Read access on a SharePoint site would be able to Post, Like, reply to a comment at a single level, @mention a person while commenting in a SharePoint page.
When someone comments on a page or news post, SharePoint notifies the author or the person mentioned in the header of the page via an email. The SharePoint mobile app also alerts the author whenever a comment is made. If there are multiple comments, it will be batched so that the authors receive a single email when several comments have been made within a short period of time. Additionally, author gets email notices when users reply to comments or leave a “like”. Author or a user can unsubscribe from notifications by clicking the “Unsubscribe” link in the footer of the email.
User with contribute access on a site would be able to delete any comments posted on the page which is quite an issue & not yet addressed by Microsoft. User with Read access to the site would be able to delete only the comments they have posted. Do you know where the comments are stored when ever you make a comment, they are stored in a separate data store with references to the Site Pages library guid & the item id of the page. The comments & likes are accessible via Rest API of the site. Find the different endpoints available for executing below actions
- Getting comments & likes of a page item
- Posting a comment on a page
- Deleting a existing comment
There are couple of nice blog posts covering this topic with the API details. Find the links below:
- Working with the Page Comments REST API in SharePoint Communication sites
- Getting likes and comments from modern pages
On this blog post I am going to show you how to access the comments details of a SharePoint page using Power Automate.
Let’s create an automated flow with trigger “Manually Trigger a Flow”, add an action “Send an Http request to SharePoint” since the API to retrieve the comments is an SharePoint rest API.
The API for getting the comments of a SharePoint page is
Header Information: accept: application/json;odata.metadata=none
The odata.metadata=none option reduces the size of the payload significantly, and for many scenarios this is all that you need when working with list items
Run the flow, the output of this action would have all the data related to the comments posted by users on the page in a JSON format. To get the required information we will have to parse the JSON with the help of the Parse JSON action. Add the Parse to JSON action as below with content to the Body from Outputs of the action “Send an Http request to SharePoint”
Click on the button “Generate from sample” which loads a popup “Insert a Sample JSON payload” paste the run data of the flow for generating the schema automatically. To get the run data, go to the run history and click the run and go to outputs of the action “Send an Http request to SharePoint” copy everything inside the Body
Find the information of the body in the JSON online viewer to decide what information you need & what is available on JSON output
Add the compose action to see all the information available from the Output of the parse action, I’ve added only text which has the comment text & email has the email address of the user posted the comment
Summary: There are different Rest API endpoints available for comments & likes in Modern SharePoint page, you can select the any of them based on the requirement. The api’s can also be used on SPFx solutions for customizing Comments feature. Hope you find this post useful. Let me know if there is any comments or feedback by posting a comment below.
One thought on “Accessing SharePoint modern page Likes & Comments using Power Automate”
Hi, is there an option in SharePoint Online to revert “unsubscribe” the comments?
I cannot find/get it.