The CDO Libraries as Automation Servers
So, let's put it all together, from the bottom up, to see how the CDO libraries work.
-
Service providers implement COM interfaces — specifically, the MAPI interfaces — as described in the MAPI documentation.
-
The CDO libraries implement several objects (Session, Message, ContainerRenderer, Format, and so on) that act as clients to these MAPI interfaces. That is, the CDO library objects obtain pointers to the MAPI interfaces and call MAPI methods.
-
The CDO libraries implement IDispatch and act as Automation servers so that they can be called by tools that can use IDispatch, such as Microsoft® Visual Basic®. That is, they allow other programs to call them through the IDispatch interface. Beginning with version 1.1, the CDO libraries are self-registering as Automation servers.
-
The CDO libraries publish type libraries that contain information about the objects they make available through IDispatch.
-
Your Visual Basic application acts as a client to the CDO libraries. It reads their type libraries to obtain information about their objects, methods, and properties. When your Visual Basic application declares a variable as an object (with code such as
Dim objSession as Object
or Dim objSession as MAPI.Session
) and uses that object's properties and methods (with code such as MsgBox objSession.Class
), Visual Basic makes calls to IDispatch on your behalf.
The relationships between these programs are shown in the following diagram. Visual Basic is a client to one or both of the CDO libraries, which are the Automation servers. The CDO libraries, in turn, act as clients to the MAPI services.