none
How can I find the email address associated with IMsgStore using MAPI? RRS feed

  • Question

  • How can I find my own mailbox email address?  Can I get it from IMsgStore?

    Thanks,

    Bin

    • Edited by bin lin Thursday, October 17, 2013 2:27 PM
    Thursday, October 17, 2013 2:21 PM

Answers

  • Then why not use IMAPISession::QueryIdentity to get the entry id of the current user, open it as IMailUser (IAddrBook::OpenEntry), then retrieve the address?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by bin lin Thursday, October 17, 2013 7:14 PM
    Thursday, October 17, 2013 6:51 PM

All replies

  • What kind of IMsgStore is it?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, October 17, 2013 3:19 PM
  • Exchange.  I am using MAPI to send emails.  But I need to find email address of the sender.


    Bin


    • Edited by bin lin Thursday, October 17, 2013 4:53 PM
    Thursday, October 17, 2013 3:21 PM
  • 1. If this is an online store (as opposed to cached), you can just read the PR_MAILBOX_OWNER_ENTRYID property

    2. If it is a cached store, you can parse the store entry id (its format is documented on MSDN) to extract the DN of the mailbox owner (take a look at the entry id in OutlookSpy - click IMsgStore button), then construct the GAL entry (its format is also documented).

    3. If you do not like option #2, you can use the profile API (IMAPISession::AdminServices, IMsgServiceAdmin.GetMsgServiceTable, search for the MSEMS services, open their provider table (IProviderAdmin::GetProviderTable, IProviderAdmin::OpenProfileSection, read the PR_ENTRYID property, compare it using IMAPISession.::CompareEntryIDs with the entry id in question. If they match, read the PR_PROFILE_MAILBOX property to get the DN of the mailbox owner.

    4. In latest versions of Outlook you can read the PR_EMSMDB_SECTION_UID property from the IMsgStore object, use it to call IMAPISession::OpenProfileSection, read the 0x6603001E property (DN of the store owner).


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!


    Thursday, October 17, 2013 4:58 PM
  • Without knowing the mailbox email address, is there a way to find out the default certificate set for signing emails?


    Bin


    • Edited by bin lin Thursday, October 17, 2013 5:36 PM
    Thursday, October 17, 2013 5:28 PM
  • What does it have to do with a message store? Do you mean the certificate that can be stored in an AD?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, October 17, 2013 6:03 PM
  • In order to send signed email messages, I need to find the certificate which you can specify in Trust Center Setting/Email Security.  I normally find it by looking at the message store email address.  Some times the message store display name is the account email address, sometime, it is something like "Mailbox - xxx".  So I am wondering if there is another way to find the which certificate is set as default for signing email messages.


    Bin

    Thursday, October 17, 2013 6:42 PM
  • Then why not use IMAPISession::QueryIdentity to get the entry id of the current user, open it as IMailUser (IAddrBook::OpenEntry), then retrieve the address?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by bin lin Thursday, October 17, 2013 7:14 PM
    Thursday, October 17, 2013 6:51 PM
  • This will work. Thanks so much.

    Bin

    Thursday, October 17, 2013 7:14 PM