How to get the store (mailbox) MAPI DN of current message?

G

George Wang

I have a profile which can open multiple mailboxes. What I want to do
is to find out the store (mailbox) MAPI DN of current message.

So far I can get the MAPI DN of default mailbox by getting
PR_PROFILE_USER from default profile section
(pbGlobalProfileSectionGuid). I can also get the
store EntryID of current message. But I'm not sure how to get the
Profile Section for non-default mailboxes? (need to find out
MAPIUID...)
 
G

George Wang

Dmitry, Thanks for the reply,

Actually I'm working on an Outlook Add-in and I have the MAPI session
pointer. Because user could have access to multiple mailboxes (one
default and others delegated), I want to in which mailbox current
selected message located. I also want to get the MAPI DN (e.g.,
/O=xx/OU=xx/CN=Recipients/CN=xx) of that mailbox.

I examined the store entry id of the mailbox, it seems that the MAPI
DN info. is encoded in this entry id. But I'm not sure if it's
reliable to extract it from it. As you know, the entry id may not be
unique (I guess that's why CompareEntryIDs() exists) So ideally I want
to get this MAPI DN from profile... Not sure if this is possible?
 
D

Dmitry Streblechenko \(MVP\)

Ok, read PR_STORE_ENTRYID from IMessage, use it to call
IMAPISession::OpenMsgStore, read PR_MAILBOX_OWNER_ENTRYID from IMsgStore.
Then either parse the entry id programmatically to extract the DN (see
_entryid.h on the Platform SDK) or use it to call IAddrBook::OpenEntry(),
then read PR_EMAIL_ADDRESS from the returned IMailUser.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top