Share via


Access to the Recovery Database in Exchange Server 2016 from an application

I have had several customers interested in how to access the Recovery Database (RDB) programmatically in Exchange 2016.  Extended MAPI is the only way to access the Recovery Database programatically.  The Exchange MAPI subsystem (aka MAPI\CDO) is the only subsystem capable of accessing the Recovery Database.  This is because access to the Recovery database requires the use of the flag OPENSTORE_RECOVERY_DATABASE (0x100000).  This flag is not available in the Outlook MAPI subsystem.  If you try to use it from Outlook's MAPI, the call to IMAPISession::OpenMsgStore() will fail with MAPI_E_UNKNOWN_FLAGS (0x80040106). Therefore, you are forced to use the Exchange MAPI subsystem.  As you know, Exchange Server 2016 has an explicit block in place that prevents from clients using the Exchange MAPI subsystem.

A programmatic alternative to MAPI  to access the RDB is through the use of Exchange Powershell's New-MailboxRestoreRequest cmdlet.  You could then restore the data to a temporary mailbox in a normal mailbox database.  Once there, you could use Exchange Web Services or the Outlook Mail REST APIs to access that data. The user of your application never has to know about this temporary mailbox.  It could only be accessible by your application.  Your application could then find whatever it is that it's looking for and then only restore that particular data to the end user's mailbox.  Previous versions of Exchange Server support both EWS and this cmdlet so this architecture could work going back to Exchange 2010. That's probably the furthest you'll want to go back anyhow.