none
How to get SMTP address of accounts in outlook2003? RRS feed

  • Question

  •      Now I know how to get accounts in outlook2007 and outlook2010. but I found  that outlook2003 is not support the _Accounts interface,so I can not use it to get Account like outlook2007. Who can tell me how to do it by Extend MAPI? 

    Thanks!

    Friday, December 13, 2013 1:19 PM

All replies

  • Hello new programmer 007,

    It looks like you are interested in the IOlkAccountManager interface. Please see the Using Account Management API (IOlkAccountManger) to List Outlook Email Accounts article for more information (a sample code is included).

    Friday, December 13, 2013 1:48 PM
  • You can see the data exposed by IOlkAccountManager interface in OutlookSpy (click IOlkAccountManager button).

    What programming language are you using?


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

    Friday, December 13, 2013 1:53 PM
  •     I am using C++ language . now my problem is that I can not get SMTP address of exchange account, As Eugene_Astafiev said, can I get IMailUser interface by using Account ID returned by IOloAccountManager interface and use IMailUser interface to query the PR_SMTP_ADDRESS property to get SMTP address?
    Saturday, December 14, 2013 2:46 AM
  • I have tried to do it , But I can not get SMTP address of exchange account
    Saturday, December 14, 2013 2:47 AM
  • What do the following properties contain?

    PROP_EXCHANGE_EMAILID            PROP_TAG(PT_UNICODE, 0x663D) //email ID
    PROP_EXCHANGE_EMAILID2                   PROP_TAG(PT_UNICODE, 0x6641) //email ID

    It looks like you get an exchange server e-mail address in the following format:

    /O=ORGANIZATION_NAME /OU=EXCHANGE_GROUP /CN=RECIPIENTS /CN=USER_NAME

    Am I right?

    Saturday, December 14, 2013 12:20 PM
  • you are right. I do not use the PROP_EXCHANGE_EMAILID and PROP_EXCHANGE_EMAILID2 property.According to the link you offer to me ,I call the GetAccount() function,I can get exchange server e-mail address,but I found Address property is NULL. when account type is POP3 ,the Address property is SMTP address. Maybe I should try to query PROP_EXCHAGNE_EMAILID or PROP_EXCHANGE_EMAILID2.
    Saturday, December 14, 2013 2:55 PM
  • What values do you get for these properties? 

     

    Saturday, December 14, 2013 4:24 PM
  • If you are working with a store, it is easier to start with the IMsgStore object instead of going through the corresponding MAPI accounts or IOlkAccountManager objects.

    1. Read PR_MAILBOX_OWNER_ENTRYID property - note that it is available in the online mode only.

    2. Otherwise parse the store entry id (PR_STORE_ENTRYID) - its format is documented on MSDN. Once you have the mailbox DN, you can construct the GAL entry id - it format is documented in _entryid.h file on MSDN or have a look at the existing GAL entry id with OutlookSpy (click IMAPISession, then QueryIdentiity if you are using Exchange in the profile).

    Once you have the GAL user entry id, you can open the owner using IAddrBook::OpenEntry as IMailUser, then read the PR_SMTP_ADDRESS or PR_EMS_AB_PROXY_ADDRESSES properties.


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

    Saturday, December 14, 2013 4:43 PM
  • It's NULL and HRESULT return 0x800c8101.
    Monday, December 16, 2013 1:00 AM
  • The error is E_ACCT_NOT_FOUND, which is not surprising since that property is not available.

    Do you actually see that property in OutlookSpy for that account (click IOlkAccountManager button)?


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


    Monday, December 16, 2013 1:15 AM
  • This method can be done, but  more complex, I hope to get a simple point! Thanks for your help!
    Monday, December 16, 2013 12:45 PM
  • I can not see these properties in OutlookSpy for this account. 
    Monday, December 16, 2013 12:53 PM