コード例 #1
0
        /// <summary>
        /// Attempts to create a new user with the given information
        /// </summary>
        /// <param name="userInformation"></param>
        public void CreateUser(UserInformation userInformation)
        {
            if (userInformation == null)
            {
                throw new ArgumentNullException("userInformation");
            }

            UserPrincipal user = new UserPrincipal(context, userInformation.SAMAccountName, userInformation.Password, true);
            user.EmailAddress = userInformation.Email;
            user.Save();
        }
コード例 #2
0
 private UserInformation GetInformationFromUserPrincipal(UserPrincipal user)
 {
     UserInformation result = new UserInformation()
     {
         SAMAccountName = user.SamAccountName,
         DisplayName = user.DisplayName,
         Email = user.EmailAddress
     };
     return result;
 }