1

I have a MS Access 2003 application where I need the current Windows logged on user's exchange email address.

Do I need to query Active Directory to do this or is there a simpler way? We have different domains in our organization and querying AD would be cumbersome.

Thanks, Bruno

Bruno
  • 6,211
  • 16
  • 69
  • 104
  • 1) **IF** the current Windows user has run Outlook on the PC and connected only to their own mailbox the settings might be in the registry somewhere under HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles. – Morbo Aug 13 '11 at 17:41
  • 2) Why do you need to search different domains? Wouldn't you only search the one domain the current user is logged in to in order to find their account and then primary email address ? – Morbo Aug 13 '11 at 17:43

1 Answers1

1

You might be able to retrieve this using the Environment variables via VBA.

http://vlaurie.com/computers2/Articles/environment.htm

Environ Function code samples for VBA

For example if you know your users login to the system as 'firstname.lastname@exchange.com' the Environ will give you 'FirstName.LastName', then you might be able to add your exchange email at the end.

Community
  • 1
  • 1
Taryn
  • 242,637
  • 56
  • 362
  • 405
  • 1
    But that's inherently unreliable. Anybody can open a command prompt and type SET statements to assign whatever environment variables they like, and then launch Access from that command prompt. – David-W-Fenton Aug 13 '11 at 21:59
  • as I said you MIGHT be able to use this. It is an option, might not be best but it is an option – Taryn Aug 13 '11 at 22:41