コード例 #1
0
        /// <summary>
        /// Get the current user email address
        /// </summary>
        /// <returns></returns>
        public static string CurrentUserEmailAddress()
        {
            var userPrincipal = WinUtils.GetPrincipal() as UserPrincipal;

            if (userPrincipal != null)
            {
                if (userPrincipal.EmailAddress != null && userPrincipal.EmailAddress.Length > 0)
                {
                    return(userPrincipal.EmailAddress);
                }
            }
            var username = WinUtils.GetCurrentUserNameWithoutDomain();
            var domain   = IPGlobalProperties.GetIPGlobalProperties();

            return(string.Format("{0}@{1}.{2}", username, domain.HostName, domain.DomainName));
        }