How to get Comments of a Sharepoint List Item in Power Automate

I am back with another blog on Microsoft Power Platform. It’s about Comments feature for a SharePoint List Item and how we can retrieve them using Power Automate.

In SharePoint for every list item we can specify comments. And you can specify multiple comments with mentions. In the below screenshot, you can see I have put multiple comments for the SharePoint List Item with mentions to people in the organization.

Retrieve Comments related to SharePoint List Item in Power Automate

But how do we retrieve these comments? Looking at the user interface, it should be easy. After all comments are associated with the List Item and we can query them.

Well yes, we can query them. But not in the easiest of ways. Let’s see how we get them in Power Automate.

I created a simple Instant cloud flow for test purpose. And use the ‘Send a HTTP request to SharePoint‘ action.

Retrieve Comments related to SharePoint List Item in Power Automate

In the action, furnish the below information as show in the screenshot.

  • Site Address – Your SharePoint site address where the list in created.
  • Method – GET
  • Uri – in the format of _api/web/lists/getbytitle(‘<LISTNAME>’)/items(‘ID’)/Comments
  • Headers – content-type: application/json
Retrieve Comments related to SharePoint List Item in Power Automate

Well, that’s half of the job done. When you execute this, you will get the results for sure. Let’s see how the results look like.

Below is how it looks in a JSON view.

Retrieve Comments related to SharePoint List Item in Power Automate

As you can see in the above screenshot, each of the comments on the list item are in the results array. You can have multiple mentions in the comments. How do you plan to parse it?

Well there can be multiple ways to parse the results. I have tried in the simplest way.

Retrieve Comments related to SharePoint List Item in Power Automate

You comments may have mentions as well. To iterate through the mentions, you need to Apply to each to the mentions property for each comment.

Below is the expression for Iterating through Mentions.

Retrieve Comments related to SharePoint List Item in Power Automate

The remaining to retrieve the mentions should not be a tough job.

Hope that helped! You will also like the below posts.

Debajit Dutta
Business Solutions MVP