I would like to know the email address of the user (assuming she's in a typical Windows office network). This is in a C# application. Perhaps something to the effect of
CurrentUser.EmailAddress;
Reference System.DirectoryServices.AccountManagement
, then
using System.DirectoryServices.AccountManagement;
UserPrincipal.Current.EmailAddress
Or with a timeout:
var task = Task.Run(() => UserPrincipal.Current.EmailAddress);
if (task.Wait(TimeSpan.FromSeconds(1)))
return task.Result;