This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Get ArcGIS License Name Snippet (ArcObjects .NET 10.4 SDK) |
Get the level of ArcGIS license currently in use.
/// <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; }
''' <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