Forum Discussion

chhe112's avatar
chhe112
Copper Contributor
Dec 08, 2020

Display Comments in Sharepoint list

Hello,

 

we can now use the new sharepoint comment function to comment a list item. 

Is there a possibilty to show the last comment in the table view? Or get this via JSON formatter?

 

I only have found a solution to get the number of comments:

https://github.com/pnp/sp-dev-list-formatting/tree/master/column-samples/generic-comment-count

 

Where are these comments stored? Is there a possibility to embed them on a sharepoint modern page?

 

  • chhe112 

     

    Currently it is not possible to get the comments using JSON formatting. You can only get the count of comments added to list item using [$_CommentCount].

     

    Comments are stored in list schema itself and not with list item. Check below blog for more information:

     

    SharePoint Online: All you need to know about Commenting in Lists 


    Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

     

    • GaryG925's avatar
      GaryG925
      Copper Contributor

      ganeshsanap I followed your link to add the Comment Count to JSON and it worked very well. Thank you for providing a usable alternate solution.

    • KWatsonLSOK's avatar
      KWatsonLSOK
      Copper Contributor

      ganeshsanap Hello! Thank you for the helpful information. I was also wondering if it is possible for comments to be included in a Power Automate flow? Currently I have flows built for list items to move from one list to another based on a Column selection ('Status') and would like for comments to also migrate when the list items moves to the other list based on the flow. Is this possible? 

       

      • ganeshsanap's avatar
        ganeshsanap
        MVP

        KWatsonLSOK 

         

        List comments are not supported by default using SharePoint connector in Power Automate. You can manage that using SharePoint REST APIs.

         

        Check "Working with SharePoint REST APIs" section in below blog for REST API endpoint to work with list comments:

        SharePoint Online: All you need to know about Commenting in Lists 


        Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

  • That's a very interesting question that I have already been asked for, but I'm not aware of a way to get list item comments. Per Ignite sessions, comments are stored within the list schema itself
  • Kevin_Flaherty's avatar
    Kevin_Flaherty
    Copper Contributor

    chhe112 I had the same issue and watched network requests while adding a comment to a list item. There's a usuable API! I reproduced like this:

    https://<tenant>.sharepoint.com/<site>/_api/web/lists(@a1)/GetItemById(@a2)/Comments()?@a1='<list guid>'&@a2='<comment ID>'

     

    Now I just need to figure out how to trigger a Flow when new comments are made :lol: Open to ideas!

    • chhe112's avatar
      chhe112
      Copper Contributor

      Kevin_Flaherty 

       

      I have found this API too. But I did not find a solution to trigger a flow if a new comment is added.

      "If a item is modified" does not trigger by sending a new comment.

       

      Are there any other solutions for this?

Resources