Forum Discussion

agrvivek11's avatar
agrvivek11
Copper Contributor
Dec 01, 2020

How to distinguish between SharePoint 2016 and 2019 programmatically

I have a common solution for SharePoint 2016 and 2019 Servers. The solution has both client side (JavaScript) and server side (SSOM and CSOM) components. For some modern UI related work, I need to find out if solution is running on 2019 or 2016. Since both have same major version (16), what is the best way to do it?

In script, is it Ok to check if modernThemingEnabled property is available in _spPageContextInfo?

For server side code, is there any feature that I can check in sites or what is the best way?

Resources