Back when Outlook 2003 shipped, we were looking for ways to reduce the number of calls we made to the server. One optimization we found was to include the FQDN of the server in the entry ID for an Exchange store. In some situations, this eliminated the need to call back to the server to get a referral. However, this also had two side effects:
- Exchange store entry IDs got much longer
- More scenarios were created where two different entry IDs point at the same object.
Now – technically, 2 shouldn’t be a concern because we all know you’re supposed to use CompareEntryIDs when comparing entry IDs (hence the name of the function). However, wouldn’t it be nice if you could get the old style entry ID for scenarios where you’re space constrained, or want to avoid the potentially expensive CompareEntryIDs call? Now you can. Whenever you want to ask for PR_STORE_ENTRYID, you can ask for PR_STORE_ENTRYID_EMSMDB_V1 instead. It’s defined as follows:
#define PR_STORE_ENTRYID_EMSMDB_V1 PROP_TAG(PT_BINARY, 0x65f6)
This will return the “old style” entry IDs that we used to use back in Outlook XP. They’re still valid now, though using them to open a mailbox may incur some additional RPCs if a referral is required. Also note that while you can memcmp two of these style entry IDs to see if they’re equal, you should not interpret a difference to mean they point at different mailboxes. To determine that they’re truly different you’d still need to use CompareEntryIDs.
Some other things to keep in mind: If you’re in cached mode, to ask for PR_STORE_ENTRYID_EMSMDB_V1 you have to bypass the cache using MAPI_NO_CACHE in your GetProps call. Also, in case the property isn’t available, your code should fall back to PR_STORE_ENTRYID. Finally, only Outlook 2003 and higher’s version of MAPI supports this property.