Re: Get user name/email ID in VBA ?

  • Thread starter Thread starter Dmitry Streblechenko
  • Start date Start date
D

Dmitry Streblechenko

Use Namespace.CurrentUser object (i.e. Application.Session.CurrentUser.Name)

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


BG said:
How can I get the email ID/user name of the current user in my code
behind? For example, if Jane is running Outlook and opens a form, I want to
get her username, which is essentially the prefix of her email address
([email protected]).
 
Thanks for the response. This does get me the user's full name, but not the prefix to their email address.
CurrentUser.Name = Paul Bunya
I am looking for PBunyan, assuming his email address was (e-mail address removed)

Is there a way to get this? Usingn CurrentUser.Address gets me a string with a lot of information in it, including the email address prefix, but is not consistently parsable.
 
It returns an EX address (that's what you are using, right?). To convert to
an SMTP address you need to read either PR_SMTP_ADDRESS or
PR_EMS_AB_PROXY_ADDRESSES from the AddressEntry object using either Extended
MAPI/CDO 1.21 or Redemption, Outlook Object Model provides no access to that
property.

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


BG said:
Thanks for the response. This does get me the user's full name, but not
the prefix to their email address.
CurrentUser.Name = Paul Bunyan
I am looking for PBunyan, assuming his email address was (e-mail address removed).

Is there a way to get this? Usingn CurrentUser.Address gets me a string
with a lot of information in it, including the email address prefix, but is
not consistently parsable.
 
Back
Top