Version 4.0 of Redemption introduced a completely new library: RDO (Redemption Data Objects) that can function as a complete replacement of the CDO 1.21 library.

While Safe*Item Redemption objects are designed to be used with either Outlook Object Model or CDO 1.21 objects to work around the security prompts with minimum modifications to the existing code, RDO is designed to provide a complete functionality replacement for CDO 1.21, which, besides being blocked by the security patch, also hasn't been updated (functionality-wise) for almost 10 years.

RDO blends the low level access of CDO 1.21 with the functionality of the Outlook Object Model. It can be used from any code: COM add-ins, EXEs, scripts, Windows Services, etc. It can be used in any language that supports IDispatch-friendly objects (VB, VB Script, Java, .Net languages, C/C++, Delphi, etc).

 

Getting Started with RDO

 

Much like CDO 1.21, only one RDO object is creatable - Redemption.RDOSession. All other RDO objects are retrieved through the RDOSession object, either directly or indirectly. Once you create an instance of the Redemption.RDOSession object, you must log on or connect to a MAPI session to be able to access other RDO objects, such as RDOStore, RDOFolder, RDOMail, etc. To differentiate between various Redemption objects (such as Redemption.SafeMailItem), all RDO object names are prefixed with "RDO": e.g. RDOMail object exposes attachments through its Attachments collection, which in turn returns Redemption.RDOAttachments objects, etc.

If you already have experience with CDO 1.21 ("Professional CDO Programming" is highly recommended), you are ready for RDO. If you are an Outlook Object Model expert, RDOSession object corresponds fairly closely to the Namespace object in OOM.

There are several ways to log on to a MAPI session in RDO:

  • set the RDOSession.MAPIOBJECT property to an instance of the IMAPISession Extended MAPI object. IMAPISession can be retrieved either through Extended MAPI using the MAPILogonEx function, Outlook Object Model (Namespace.MAPIOBJECT property in Outlook 2002 and up) or CDO 1.21 (Session.MAPIOBJECT property)

  • RDOSession.Logon method to log to an existing profile, which takes several parameters, including the MAPI profile name (pass an empty string to use the default MAPI profile)

  • RDOSession.LogonHostedExchangeMailbox method, which takes SMTP address of the mailbox and the user credentials (user name and password). The created temporary profile connects to the specified Exchange 2013 or newer mailbox in the MAPI-over-HTTP or RPC-over-HTTP mode.

  • RDOSession.LogonExchangeMailbox method, which takes the Exchange Server name (e.g. "mail.mydomain.com") and the mailbox name or address (e.g. "Joe the User" or "joe.user@mydomain.com"). This is similar to using a dynamic profile in CDO 1.21. This method connects in the old RPC mode, which Exchange 2016 or newer no longer support.

  • RDOSession.LogonPstStore method, which takes the PST file name and creates a temporary MAPI profile (immediately deleted) with the specified PST store as the only service in the profile.

Once you are logged on to a MAPI session, you can start accessing various MAPI objects exposed by RDO. The example below logs to the default MAPI session and prints out the subject of all messages in the Inbox folder:

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.GetDefaultFolder(olFolderInbox)
for each Msg in Inbox.Items
  Debug.Print(Msg.Subject)
next

 

Of course you can mix RDO with the Outlook Object Model or CDO 1.21. The example below reads the (blocked by Outlook) SenderName property from an Outook MailItem object using RDO

set Session = CreateObject("Redemption.RDOSession")

'make sure RDO uses the same MAPI session as Outlook. Outlook 2002 and up only!
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
Msg = Session.GetItemFromID(MailItem.EntryID)

MsgBox Msg.SenderName

 

The same functionality can of course be implement using the old SafeMailItem Redemption object:

set SafeItem = CreateObject("Redemption.SafeMailItem")

SafeItem.Item = MailItem

MsgBox SafeItem.SenderName

 

 

Major differences between RDO and CDO 1.21/OOM

  • RDOSession object provides 3 distinct ways to log/connect to a MAPI session: set the MAPIOBJECT property, call Logon, LogonExchangeMailbox or LogonPstStore methods.

  • Extended MAPI properties can be accessed either using regular property tags (e.g. PR_SUBJECT = 0x0037001E) or using the property DASL schema names (e.g. "urn:schemas:httpmail:subject" or "http://schemas.microsoft.com/mapi/proptag/0x0037001E") through the Fields() collection. See IRDOFolder, IRDOAddressBook, IRDOStore, IRDOMail, IRDOAttachment, IRDOAddressEntry, IRDOAddressList (derived from the _MAPIProp object) .

  • RDO exposes Outlook mail, store and address book accounts through the RDOSession.Accounts collection and RDOMail.Account property (Outlook 2002 and up only).

  • Unlike Outlook Object Model, RDO exposes the Stores collection through the RDOSession.Stores property

  • RDOSession.AddPstStore returns the newly added PST store (unlike OOM). CDO 1.21 does not expose this functionality at all

  • RDOSession.AddDelegateExchangeStore allows to add a delegate Exchange mailbox

  • RDOPstStore object exposes the PST store file path (PstPath property).

  • RDOAddressBook.ResolveName allows to resolve a name and return the corresponding RDOAddressEntry object.

  • Names can be resolved against a particular address list, not just the whole address book. See AddressList.ResolveName.

  • RDOFolder exposes the DeletedItems collection which allows access to the deleted (but recoverable) messages (Exchange Server only).

  • Messages can be deleted in 3 modes - deleted but recoverable by Exchange, move to the Deleted Items folder, hard deleted (not recoverable in Exchange). See RDOMail.Delete and RDOItems.Remove.

  • RDOAddressBook.SearchPath collection exposes the Address Book search path (used in the automatic name resolution by Outlook)

  • RDOSearchFolder object (derived from the RDOFolder object) exposes functionality related to the MAPI search folders.

  • RDOFolder.ACL collection (RDOACL object) exposes Access Control List (ACL) for the Exchange folders.

  • RDOStore.Reminders collection exposes reminders on the per-store level (similar to the Application.Reminders collection in the Outlook Object Model).