How to avoid security prompts in Visual Basic programs for Outlook
A few words about developing applications for Microsoft Outlook
Microsoft Outlook offers three interface sets for software developers:
- Outlook object model (further on referred to as OOM), which has tools designed both to work with data storage, and to automate and controls Outlook, e.g., by adding new control elements into Outlook menus and toolbars.
- CDO (Collaboration Data Objects) — a high-level interface set that allows working with Outlook mail system and, when used for Microsoft Outlook, an extension over MAPI system.
- MAPI (Messaging Application Programming Interface) — an open e-mail system interface offered by Microsoft in the early 1990-s, also known as Extended MAPI (to avoid confusion with the set of 12 functions called Simple MAPI).
Outlook blocks the OOM and CDO methods, but it doesn't affect MAPI methods, as MAPI interfaces are inaccessible from script programming languages (such as JScript and VBScript) and from Visual Basic.
CDO, OOM and MAPI when working with Outlook data storage operate the same data sets represented by various objects. So, for example, an e-mail message is represented by a Message type object in CDO, by a MailItem type object in OOM, and by an object implementing the IMessage interface in MAPI. Properties of those objects, though differently named, provide access to the same data. So, with CDO, an e-mail message sender's address can be accessed through Message.Sender.Address, with OOM it can be accessed with the SenderEmailAddress property of the _MailItem object, and through the PR_SENDER_EMAIL_ADDRESS property of an object using the IMessage interface with MAPI.
While attempts at accessing Message.Sender.Address or _MailItem.SenderEmailAddress properties results in a security system warning, accessing the PR_SENDER_EMAIL_ADDRESS property of a MAPI object won't result in such a warning.
Visual Basic software developers are lucky that both CDO and OOM objects have the MAPIOBJECT property which refers to the MAPI interface corresponding to that object. The MAPIOBJECT has been available with OOM and CDO starting from Microsoft Outlook '98. However, the Microsoft article 296483 says that the MAPIOBJECT property has been added to OOM objects with the sole purpose of providing compatibility with CDO, and it is a "hidden property of Outlook Object Model objects, and is not meant to be used from the Outlook object". Though, we don't know about any limitations for usage of that property with OOM, except the ones described here.
Well, MAPI interfaces are here ready to come to rescue, so, how can one use them?
|
|