Forum Discussion

jaycee75's avatar
jaycee75
Copper Contributor
Jul 01, 2025

JSON Formatting - to Open a Preview of a older version.

Hi I have in some of my libraries a column with a formatted button(its a url type) that clicking it will open a Browser "Preview view"  of the office document.

"href": "=@currentWeb +'/_layouts/15/Doc.aspx?sourcedoc=' + [$UniqueId] + '&action=embedview'"

Hi have also this code which opens the most current published version of a document (and not a draft)- however this opens it within word in view mode, using this code

 

"href": "=if([$_UIVersion] % 512 == 0, [$FileRef], @currentWeb + '/_vti_history/' + 512*floor([$_UIVersion]/512) + substring([$FileRef], indexOf(@currentWeb+'^','^')-indexOf(@currentWeb,'.sharepoint.com')-15, indexOf([$FileRef]+'^','^')))"

Is it possible to somehow merge these two bits of code so that I can get it to open the published versions in the browser preview mode?

1 Reply

  • HarHoare's avatar
    HarHoare
    Iron Contributor

    In the JSON formatting of the SharePoint list, add the openInClient: true attribute with the version number and you can preview the old version of the file.

Resources