/// <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(); }
private UserInformation GetInformationFromUserPrincipal(UserPrincipal user) { UserInformation result = new UserInformation() { SAMAccountName = user.SamAccountName, DisplayName = user.DisplayName, Email = user.EmailAddress }; return result; }