Click or drag to resize
PMEnvironment Class
Represents the installed environment of Print Manager Plus on one or more servers
Inheritance Hierarchy
SystemObject
  PM90SettingsAPIPMEnvironment

Namespace: PM90SettingsAPI
Assembly: PM90SettingsAPI (in PM90SettingsAPI.dll) Version: 9.0.23.534 (9.0.23.534)
Syntax
C#
public class PMEnvironment

The PMEnvironment type exposes the following members.

Constructors
  NameDescription
Public methodPMEnvironment
Initializes a new instance of InstallationInfo which connects to the database and attempts retrieve basic information
Top
Properties
  NameDescription
Public propertyDatabaseCatalog
The Database name within SQL Server
Public propertyDatabaseInstance
The MS SQL Server Instance this installation is pointed to
Public propertyDatabaseVersion
The database schema version number as a string
Public propertyInstallationVersion
The installed or last run version.
Public propertyStatic memberInstalledLocally
Returns true if the PMTracking service is installed locally, based on Programs and Features.
Public propertyStatic memberServiceReachable
Checks that service is actually reachable. First checks InstalledLocally for possible quick fail.
Top
Exceptions
ExceptionCondition
PMDatabaseConnectionNotFoundExceptionNo database connection available on this system
PMDatabaseExceptionRepresents an database connection or syntax error that has occurred when processing an API request
PMExceptionUnexcpected exception has occurred, check inner exception
Remarks
Most information regarding version, is pulled from the Primary Installation
Examples
Example of getting service state.
try
{
    //Checking if service is installed
    if (PMEnvironment.InstalledLocally)
    {
        Console.WriteLine("Service installed");


        if (PMEnvironment.ServiceReachable)
        {
            Console.WriteLine("Service reachable");
        }
    }



    PMEnvironment info = new PMEnvironment();

    Console.WriteLine("SQL Server           : " + info.DatabaseInstance);
    Console.WriteLine("Database Name        : " + info.DatabaseCatalog);
    Console.WriteLine("Database Version     : " + info.DatabaseVersion);
    Console.WriteLine("Installation Version : " + info.InstallationVersion);



}
catch (PMDatabaseConnectionNotFoundException)
{
    Console.WriteLine("No Print Manager Plus database connection exists on this system.");
}
catch (PMDatabaseException ex)
{
    //The inner exception will typically contain the raw database error information
    Console.WriteLine("Database Error : " + ex.InnerException != null ? ex.InnerException.Message : ex.Message);
}
catch (PMException ex)
{
    //other exceptions
    Console.WriteLine("API Error: " + ex.Message + ex.InnerException != null ? (", The inner exception message is: " + ex.InnerException.Message) : "");
}
See Also