1

Inside my SharePoint 2016 project,I want to programmaticlly check the SharePoint 2016 edition (standard - enterprise - foundation).

I've found the SharePoint version But I would like to have SharePoint 2016 edition using c#.

Please help me with sample code!

3

You can simply get the SharePoint 2016 Edition using C# as the following:

First Add the below reference to your solution

  • Microsoft.SharePoint
  • Microsoft.SharePoint.Administration

Second, include the below namespaces

using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

Third, use the below code to get the Sharepoint 2016 Edition based on its corresponding GUID

Microsoft.SharePoint.Administration.SPFarm spfarm = SPFarm.Local;
string editionguid = spfarm.Products.Last().ToString();
string edition = "";

   if (editionguid == "5db351b8-c548-4c3c-bfd1-82308c9a519b")
      {
         edition = "SharePoint Server 2016 Trail";
      }
   else if (editionguid == "4F593424-7178-467A-B612-D02D85C56940")
      {
          edition = "SharePoint Server 2016 Standard";
      }
   else if (editionguid == "716578d2-2029-4ff2-8053-637391a7e683")
      {
          edition = "SharePoint Server 2016 Enterprise";
      }
   else
      {
        edition = "it's not SharePoint 2016";
      }

By the way, I tried the above code in two different farms (SharePoint 2016) that worked properly


Also, To get the GUID, you can use the below SharePoint PowerShell cmdlet

(Get-SPFarm).Products

In Sharepoint 2016, The result of the above cmdlet show two GUID. The last GUID refers to your SharePoint 2016 Edition.

1

You can use below property to find the build version number

SPFarm.Local.BuildVersion;

If it starts with 16.0 that means its SharePoint 2016

Edition information is stored in registry path - HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\WSS\InstalledProducts

Then look for GUID's to check the proper edition

5DB351B8-C548-4C3C-BFD1-82308C9A519B = SharePoint 2016 Trail
716578D2-2029-4FF2-8053-637391A7E683 = SharePoint 2016 Enterprise
4F593424-7178-467A-B612-D02D85C56940 = SharePoint 2016 Standard

Try this 2010 codebase - https://msdn.microsoft.com/en-us/library/ff721969.aspx and update it using above information

  • Yes i know that , i said in my question I can get the version but I would like to get the SharePoint 2016 edition Is it standard or enterprise or foundation ? – Aashirya Aug 17 '17 at 14:40
  • @Aashirya please see my updated answer – Amal Hashim Aug 17 '17 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.