Open SharePoint Document Versions from a link
Microsoft Teams Files Tab does not show file version history. What do we do?
I asked myself many times how to open the versions in separate windows from the SharePoint list view or different screens. Typical example is Microsoft Teams where the Files tab does not offer the ability to open version history unless you first select the file, then right-click the mouse to open the context menu, then click preview, and finally then from the top menu you select the three dots and from the drop-down select version history.
This is a SharePoint Application page that will show you the old school versions dialog that is even currently now used in modern pages. Append '&IsDlg=1' if you want to get rid of some UI and attach it to your custom iframe functionality. Like:
The easiest way is to have an extra column with column formatting to append the fileName string dynamically and give you this version history option. The downside of this quick solution is that clicking the link will open it in a new tab of the browser.
If you'd like the Version History to open in the same tab. A better approach would be to use a text field and column formatting to make it happen. Setting the target to _self will give us open in the same window, but the user experience is still poor since a classic page opens in teams and there is no way to navigate back.