OLE API versus COM API

When writing customizations, you need to access various objects that can be used to affect the workflow and modify states and properties of the instances that exist at certain points in the production flow. The set of such objects are available in each event, through a catalogue provided by the API.

In ReadSoft Invoices 5.2 SP4 and later, there are two parallel object catalogues available. Both are in fact built using COM/OLE technology. However, for historical reasons they are called OLE API (sometimes referred to as the Classic API) and COM API.

OLE API

This is the old catalogue, and it was the only way to access objects before ReadSoft Invoices 5.2. The set of abstractions is fairly limited, and support for this will be discontinued in the future. Therefore, we recommend you use the COM API in new customizations.

Navigation though the objects begins with the top Application object, which is available in two ways:

  • When using the VBA engine, the global Application variable provides an object reference to the OLE API representation of the application object.
  • When using a plug-in event handler, the same reference is available by calling GetClassicObject from the ehApp parameter in the Connect method.

The OLE API uses Get and Set methods instead of properties.

COM API

This is the strongly recommended way to access API objects. In contrast to the old OLE API catalogue, the object model is more flexible and highly object-oriented, with support for Collections and Get/Set/Let properties. There is also a type library available, which supports early binding and IntelliSense in supported development environments.

Navigation though the objects begins with the top Application object, which is available in two ways:

  • When using the VBA engine, the global ApplicationEx variable provides an object reference to the COM API representation of the application object.
  • When using a plug-in event handler, the same reference is available using the Application variable given as a parameter in the Connect method.

If the type library is used and referenced (which is highly recommended, but not available when using the VBA engine), the Application object reference can be set to the more specialized reference variables when used in those modules:

COM-specific help topics are labeled in the upper right-hand corner to differentiate them from OLE API topics.

If necessary, you can use the GetClassicObject method to access OLE objects from the COM API.