I am working on a C# application and need to retrieve the email address of the current user. The user is part of a typical Windows office network. I am looking for a way to get this information programmatically.
Here is a rough idea of what I am aiming for:
string emailAddress = CurrentUser.EmailAddress;
Could someone guide me on how to achieve this? What APIs or methods should I use?
If you're behind a Windows domain, you could always grab their email address out of Active Directory.
See Javier G. Lozano's example in his tutorial, "Querying Active Directory for User Emails".