Partager via


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

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