This document is archived and information here might be outdated.  Recommended version.


Get ArcGIS License Name Snippet (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference

Get ArcGIS License Name Snippet

Get the level of ArcGIS license currently in use.

[C#]
/// <summary>
/// Get the level of ArcGIS license currently in use.
/// </summary>
/// <returns>A System.String that is the ArcGIS license type. Example "ArcView"</returns>
/// <remarks></remarks>
public System.String GetArcGISLicenseName()
{

  ESRI.ArcGIS.esriSystem.IESRILicenseInfo esriLicenseInfo=new ESRI.ArcGIS.esriSystem.ESRILicenseInfoClass();
  System.String string_LicenseLevel=null;

  if (esriLicenseInfo.DefaultProduct == ESRI.ArcGIS.esriSystem.esriProductCode.esriProductCodeViewer)
  {
          string_LicenseLevel="ArcView";
  }
  else if (esriLicenseInfo.DefaultProduct == ESRI.ArcGIS.esriSystem.esriProductCode.esriProductCodeEditor)
  {
          string_LicenseLevel="ArcEditor";
  }
  else if (esriLicenseInfo.DefaultProduct == ESRI.ArcGIS.esriSystem.esriProductCode.esriProductCodeProfessional)
  {
          string_LicenseLevel="ArcInfo";
  }

  return string_LicenseLevel;

}
[Visual Basic .NET]
''' <summary>
''' Get the level of ArcGIS license currently in use.
''' </summary>
''' <returns>A System.String that is the ArcGIS license type. Example "ArcView"</returns>
''' <remarks></remarks>
Public Function GetArcGISLicenseName() As System.String

  Dim esriLicenseInfo As ESRI.ArcGIS.esriSystem.IESRILicenseInfo=New ESRI.ArcGIS.esriSystem.ESRILicenseInfoClass
  Dim string_LicenseLevel As System.String=Nothing

  Select Case esriLicenseInfo.DefaultProduct
    Case ESRI.ArcGIS.esriSystem.esriProductCode.esriProductCodeViewer
      string_LicenseLevel="ArcView"
    Case ESRI.ArcGIS.esriSystem.esriProductCode.esriProductCodeEditor
      string_LicenseLevel="ArcEditor"
    Case ESRI.ArcGIS.esriSystem.esriProductCode.esriProductCodeProfessional
      string_LicenseLevel="ArcInfo"
  End Select

  Return string_LicenseLevel

End Function

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.System