Reference System.DirectoryServices.AccountManagement
, then
using System.DirectoryServices.AccountManagement;
return UserPrincipal.Current.EmailAddress;
See .NET docs UserPrincipal.Current and UserPrincipal.EmailAddress.
Or with a timeout:
var task = Task.Run(() => UserPrincipal.Current.EmailAddress);
if (task.Wait(TimeSpan.FromSeconds(1)))
return task.Result;