Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
Unlike the ActiveX Data Objects (ADO) and Active Directory Services Interfaces (ADSI) object models, the Collaboration Data Objects (CDO) component provides a consistent interface-driven object model for all programming languages.
For example, most ADSI objects expose multiple interfaces to clients that can bind directly to COM interfaces. However, for Automation clients such as scripting languages, each object exposes a single implementation of the IDispatch interface that is adjusted to include all methods and properties on all oleautomation interfaces on the object.
With CDO, however, the notion of the interface is preserved, and you therefore must navigate to the appropriate interface that exposes the functionality you require. VBScript provides no inherent mechanism for interface navigation, so CDO COM interfaces have been designed to provide this mechanism for you. Many CDO interfaces provide an implementation of the GetInterface method. This method takes a string identifying the desired interface and returns that interface if it is exposed. It acts as a IUnknown::QueryInterface on the object for use by languages that do not support interface navigation. One very common example is the CDO IMessage interface. Objects that expose the IMessage interface normally also expose the IDataSource and IBodyPart interfaces as well. You can use IMessage::GetInterface to navigate to these interfaces using scripting languages (or anytime you only can access the object through the IDispatch interface).
Dim iMsg Set iMsg = CreateObject("CDO.Message") Dim iDsrc Set iDsrc = iMsg.GetInterface("IDataSource") Dim iBp Set iBp = iMsg.GetInterface("IBodyPart") ...
Many CDO interfaces also expose properties that return interfaces on the same object. Using the IMessage interface example again, the IDataSource and IBodyPart interfaces are accessible using the IMessage::DataSource and IMessage::BodyPart properties:
Dim iMsg Set iMsg = CreateObject("CDO.Message") Dim iDsrc Set iDsrc = iMsg.DataSource Dim iBp Set iBp = iMsg.BodyPart ...
In this case, you can use either the corresponding property on the interface, or the GetInterface method to navigate these interfaces.
You cannot access interfaces on objects that are not oleautomation compatible. For example, to allow C++ programmers access to raw OLE DB interfaces for items, instances of the CDO Message COM class expose the OLE DB IRow interface. This interface cannot be used by scripting languages and therefore is never returned by a property on an interface or through GetInterface. It is of course accessible through QueryInterface.