Back to column formats
Column formattingSharePoint Online

Item Version History

This sample demonstrates how to build a button to display the version history of an item in SharePoint Online.

Item Version History formatting preview
Sample preview · View original animation

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": "a",
  "attributes": {
    "href": "=@currentWeb+'/_layouts/15/Versions.aspx?list={ LIST ID }&ID='+[$ID]",
    "target": "_blank",
    "data-interception": "off"
  },
  "style": {
    "text-decoration": "none"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "History"
      },
      "style": {
        "margin-right": "5px"
      }
    },
    {
      "elmType": "span",
      "txtContent": "Version history"
    }
  ]
}

From the contributor

How to use this sample

Summary

Since document sets rely on a different style of version history (captured versions) - sometimes you want to see how the metadata has changed over time, using the Versions.aspx page over the DocSetVersions.aspx works awesome, but this is also really useful just to make the version history for someone.

screenshot of the sample

[!NOTE]
If you use this sample, you need to set the LIST ID. If not set, the link will not work. screenshot of how to find List ID

View requirements

  • This format can be applied to any column type, I used a calculated field with the ="" formula.

Sample

Solution Author(s)
generic-item-version-history.json Dan Toft

Version history

Version Date Comments
1.0 May 12, 2023 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.