Re: How to get a comments from a sharepoint list in an email with Power automate?
Hi @Anonymous,
You can use the following URI to only retrieve 1 comment. Microsoft is automatically sorting it descending, so this will be the last comment.
_api/web/lists/getbytitle('@{variables('ListName')}')/items(@{variables('ListItemId')})/Comments?$top=1
If you want to avoid using a parse json and an apply to each action you can also use an expression to retrieve the correct fields of the comment item.
Below is an example of retrieving the text of a comment of the first (and only) item in a compose action by using an index [0] and the text field.
outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['results'][0]['text']
