Visio 2010 - Check the Edition at Runtime

With the release of Visio 2007 you could no longer rely on just a check to see if Visio was installed, you also needed to know the Edition or SKU that was installed if you were to use the Data Linking or Data Graphic capabilities via the API.  Now with the release of Visio 2010 Premium there is another reason to check the edition at runtime.

Visio 2010 Premium includes new functionality for rules based validation which is available via the API, however, this functionality and APIs are only available to user of the Premium edition, meaning that if your solution uses these APIs you will need to make sure that they are available before calling them.

CurrentEdition is a new property that has been added to the Application class which is set to one of the following values at runtime:

visEditionStandard
visEditionProfessional
visEditionPremium

Using this new property you can determine if the running instance of Visio that is hosting your solution supports rules validation.

Here are two simple properties that you can add to your ThisAddin class (if you are using VSTO) that you can use to:

Check for Data features support:

internal bool DoesVisioSupportDataFeatures
{
get
{
bool retVal = false;

        if (this.Application != null &&
            this.Application.TypelibMinorVersion >= 12)
{
retVal = this.Application.DataFeaturesEnabled;
}

        return retVal;
}
}

Check for Process features support:

internal bool DoesVisioSupportProcessFeatures
{
get
{
bool retVal = false;

        if (this.Application != null &&
this.Application.TypelibMinorVersion >= 14)
{
if (this.Application.CurrentEdition ==
Visio.VisEdition.visEditionPremium)
{
retVal = true;
}
}

        return retVal;
}
}