UserMgmtManager.AddUser Method (String, PersonalInfo)
Adds a new user account with the specified user name and personal information.
Namespace: Microsoft.WindowsServerSolutions.Users
Assembly: UserObjectModel (in UserObjectModel.dll)
Syntax
public User AddUser(
string userName,
PersonalInfo info
)
public:
User^ AddUser(
String^ userName,
PersonalInfo^ info
)
Public Function AddUser (
userName As String,
info As PersonalInfo
) As User
Parameters
userName
Type: System.StringThe name of the new user account.
info
Type: Microsoft.WindowsServerSolutions.Users.PersonalInfoThe personal information of the user.
Return Value
Type: Microsoft.WindowsServerSolutions.Users.User
An instance of User.
Exceptions
Exception | Condition |
---|---|
UserException | The user account could not be added. |
Examples
The following code example shows how to add a new user account:
PersonalInfo pi = new PersonalInfo();
pi.AccessLevel = AccessLevelType.Administrator;
pi.FirstName = Resources.NetworkAdminFirstName;
pi.LastName = string.Empty;
pi.RemoteAccess = RemoteAccessType.Allowed;
UserMgmtManager um = new UserMgmtManager();
User newUser = um.AddUser(userName, pi);
See Also
PersonalInfo
RemoteAccessType
User
AddUser Overload
UserMgmtManager Class
Microsoft.WindowsServerSolutions.Users Namespace
Return to top