Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to return CurrentUser's Email Address?

Status
Not open for further replies.

shelbytll

Programmer
Dec 7, 2001
135
SG
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[\b]

I am a clever newbie...[peace]
 
Have you tried CurrentUser.Address instead?
 
When in outlook VBE (Alt-F11) launch the object browser (F2) and do a search for currentuser, then press the magical F1 key to see an example on how to get the CurrentUser Recipient object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi,
I tried CurrentUser.Address and it return me:
/o=myDomainName/ou=First Administrative Group/cn=Recipients/cn=shelby



I am a clever newbie...[peace]
 
Looks like the namespace isn't set right. I used:

Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
MsgBox ns.CurrentUser.Name
MsgBox ns.CurrentUser.Address

and it provided the info you wanted. Look up the 'Recipient' object to get the details.
 
I have been trying this as well. I think the namespace is set correctly, but I get similar returns, where it includes the domain details.

I tried explicitly set myself as a Recipient object, but Address still comes back with the domain, and admin group OU.

Any other thoughts?

Gerry
 
Gerry:

What do you get when you use the immediate window of the VBE to check these values:

ThisOutlookSession.Session.Type
ThisOutlookSession.Session.CurrentUser

Are you connecting to an exchange server? I'm using a POP3 connection to my ISP's server.

Ron
 
Yes I am connecting to an exchange server.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top