How To Programmatically Access Exchange 2010 Archive Mailboxes
Archive mailboxes are a new concept in Exchange 2010 that solve some of the problems inherent in PST archives – the primary of which being that there’s no way to access your PST files from a different machine. Archive mailboxes solve this by providing you a second mailbox you can use to archive mail from your primary mailbox in a location that is accessible via OWA and from other computers.
In a future release, there should be functionality to access these archive mailboxes with web services, but as of the time of this writing, there’s no way to access the archive mailboxes with EWS.
You can, however access these new mailboxes with MAPI. You simply pass the legacy DN of the mailbox into IExchangeManageStore::CreateStoreEntryId to create an ENTRYID you can use in your call to OpenMsgStore. The LegacyDN you need can be retrieved from a call to the new SOAP AutoDiscover service. Simply call GetUserSettings and include the AlternateMailboxes setting in your RequestedSettings value. If you get a result in this property, and it looks just like your UserDN but with an added /guid=<some guid> at the end, then that’s your archive mailbox.
Comments
Anonymous
March 08, 2010
You can read the GUID from the active directory entry of the user, too. The msExchArchiveGUID (octect) contains the GUID which has to be properly formatted as a text in the correct byte order. So you don't need the EWS. The interesting thing is, that the AD contains one single entry for the Archive and the EWS has AlternateMailboxes Collection... so probably in future Versions there will be multiple archive mailboxes in Exchange?Anonymous
March 19, 2010
This is rather unfortunate. I was hoping EWS would have access to the archives, as in 2007, you had access to all the content using delegate access to go into other mailboxes, with the SMTP address of the mailbox you want when you perform a GetFolder operation, but since there is no specific e-mail for the archive, you cannot log in with that method. It seems there is no alternative way to specify information that will get you the folder ID of the DistinguishedFolderIdNameType.msgfolderroot. Getting just this ID would be awesome, because I assume that once you have this id, all other methods would perform as normal. Is there no way to get this folderId, maybe by computing something from the LegacyDN or an EntryID or other information retrieved through the AutoDiscover service, or even MAPI? Or maybe the AD values msExchArchiveName or msExchArchiveGuid? Having to fall back to MAPI to access the archive seems like falling back on old technology.Anonymous
March 22, 2010
I agree, L-D, but don't worry - accessing the archive mailbox with EWS will be here soon. :) PatrickAnonymous
March 24, 2010
Do you have a rough idea how soon this feature will be available? It would be really nice to have it. thanks!Anonymous
March 25, 2010
Patrick, I tried the steps given here to PROGRAMMATICALLY access E14 archive mailbox through MFCMapi, but I get the following error MAPI_E_FAILONEPROVIDER (0x8004011D). Steps:
- Retrieved the legacy dn of the Archive mailbox using Autodiscover service.
- Logged on using exchange built in domain administrator account profile through MFCMapi
- Selected the option "Open Mailbox with DN" in MFCMapi
- Supplied the archive mailbox legacy DN and exchange server name. CreateStoreEntryID flags 0x00000009 I receive MAPI_E_FAILONEPROVIDER error. How ever, I'm able to access the primary mailbox using the above steps from the Exchange built in domain administrator account through MFCMapi. Could you help me out on this? Thanks in advance.