How to return CurrentUser's Email Address?

S

Shelby

Hi,
I'm trying to develop a Com Add-in for Outlook.

So now when I launch my Outlook, I'm able to see the new button I created on
the toolbar.

My question is, how do I return the current user email address? I manage to
return the current user Name with
oApp.Session.CurrentUser.Name


When I try to return the Email Address with:
oApp.Session.CurrentUser.Address
It return me:
/o=myDomainName/ou=First Administrative Group/cn=Recipients/cn=shelby
 
K

Ken Slovak - [MVP - Outlook]

You get the Exchange distinguished name, not the equivalent SMTP address
that way. To get the SMTP address you can't use the Outlook object model in
that case. You would have to use CDO 1.21 (optional installation for Outlook
2000 or later and security restricted) or Extended MAPI (C++ or Delphi only)
or Redemption (3rd party library at www.dimastr.com/redemption) code to get
that.

See http://www.cdolive.com/cdo5.htm#SMTPAddressOfCurrentUser for a CDO 1.21
example of getting the SMTP address. The MAPI property used would be the
same for Extended MAPI or Redemption code also.
 

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