Back to column formats
Column formattingSharePoint Online

Display Comment Count

This sample shows the comment count for a list item.

generic-comment-count
Sample preview · View original image

Copy. Apply. Make it yours.

Get this format

1 definition

Review the requirements below, then paste this JSON into the matching formatting panel. Show me where.

Use your list's internal column names and replace any tenant-specific URLs or flow IDs. Formatting is presentation, not a way to secure data.

Column formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontSize-m"
  },
  "children": [
    {
      "elmType": "span",
      "style": {
        "padding-right": "10px"
      },
      "attributes": {
        "iconName": "Comment"
      }
    },
    {
      "elmType": "span",
      "txtContent": "=if([$_CommentCount] == '' , 0 ,[$_CommentCount])"
    }
  ]
}

From the contributor

How to use this sample

Summary

This sample shows the comment count for a list item.

screenshot of the sample

screenshot of the sample

View requirements

This format can be applied to any column type.

Sample

Solution Author(s)
generic-comment-count.json Tetsuya Kawahara

Version history

Version Date Comments
1.0 December 3, 2020 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.