Appendix B. Programming the Outlook Object Model

The Outlook object model is a collaboration-enabling technology similar to CDO. It is similar in that it provides Visual Basic a way to access MAPI and also exposes its features via Automation. Many programming tasks are well suited to either technology. The Outlook object model typically is used when writing VBScript or VBA (in Outlook 2000) inside Outlook itself, or when a program needs to access all of the properties of Outlook-specific items (such as tasks and contacts). Standalone messaging applications that aren’t Outlook-specific use CDO. UI-less applications must use CDO.

The purpose of this appendix is to give you a brief introduction to the Outlook object model, but not to document the model in its entirety. This appendix shows how to use the Outlook object model to establish a MAPI session and to send and receive plain-text emails. Recall that Outlook Express is not the same as Outlook. Outlook Express does not expose the Outlook object model.

The Outlook Object Model Diagram

Figure B-1 shows the portion of the Outlook object model diagram that supports the functionality used in this appendix. (For a definition of object models and object model diagrams, see Chapter 5.)

A portion of the Outlook object model

Figure B-1. A portion of the Outlook object model

Similar to the CDO object model, the Outlook object model represents MAPI’s folders-within-folders hierarchy ...

Get CDO & MAPI Programming with Visual Basic: now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.