How to get the PrimarySmtpAddress from a x.500 format address in outlook addin RRS feed

  • Question

  • Hello,

    Here is my problem:  In my outlook addin, I am going to construct a MailItem  and send it. I assign the 'to' of the MailItem with a x.500 address, such as "/o=ComTest/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=test@comtest.com228". This x.500 address is what I get from the outlook address book. Then I find that this address can not be resolved correctly.

    Outlook.MailItem newmail = (Outlook.MailItem)app.CreateItem(Outlook.OlItemType.olMailItem); = "/o=ComTest/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=test@comtest.com228";

    ...// set other filed of the newmail



     After ReolvedAll() is called, I get such a recipient{ Address:/cn=Recipients/cn=test@comtest.com228, Name:/o=ComTest/ou=Exchange Administrative Group (FYDIBOHF23SPDLT, AddressEntry.AddressEntryUserType:olSmtpAddressEntry}.  But it should be a olExchangeUserAddressEntry addressEntry and should have a correct Address.

    For the address like this"/o=ComTest/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=test2.comtest.com228" which doesn't contain '@',  it resolves perfectly.

    My question is: how could I get a correct Address(a real smtp address) from this kind of  x.500 address?


    • Edited by zhdai Monday, August 19, 2013 2:10 PM
    Monday, August 19, 2013 12:16 AM

All replies

  • Can you try to get rid of the "EX:" prefix?

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, August 19, 2013 2:41 AM
  • Hi Dmitry,

    Yes, I have tried to get rid of the "EX:".

    The Address "/o=ComTest/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=test2.comtest.com228" works fine.  The address is resolved to the right exchange user.

    But the Address "/o=ComTest/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=test@comtest.com228" still got the same problem.  It resolved to { Address:/cn=Recipients/cn=test@comtest.com228, Name:/o=ComTest/ou=Exchange Administrative Group (FYDIBOHF23SPDLT, AddressEntry.AddressEntryUserType:olSmtpAddressEntry}

    • Edited by zhdai Monday, August 19, 2013 2:05 PM
    Monday, August 19, 2013 2:03 PM