The function CreateUser creates a new user in your project’s security system.

Function Group Execution Windows Embedded Thin Client Mobile Access
CreateUser Security Synchronous Supported Supported Supported Not supported


Web Studio Help nctions security createuser.xml d420000e112 CreateUser
The name of the user to be created, and the group(s) to which the user will belong. You can specify multiple groups by separating them with a comma.

These are optional parameters; if no values are specified, a dialog box will be displayed on the client so that the current user can provide the information.

The user’s password.

This is an optional parameter; if no value is specified, the user will not have a password. (To specify one later, either call the function SetPassword or edit the user’s settings in the project security system.)

The full name of the user.

This is an optional parameter; if no value is specified, the user will not have a full name. (To specify one later, edit the user’s settings in the project security system.)

Returned value

This function returns the following possible values:
Value Description
-1000 Could not display dialog box. The function should executed on the client.
-1 Internal error. Please contact Support.
0 New user created successfully.
1 Invalid number of parameters.
2 Wrong parameter type.
3 User name already exists.
4 Group does not exist.
5 Failed to save to configuration file.
6 Invalid user.
7 User full name already exists.
8 Reentrant function call not allowed.
9 User clicked Cancel on the Create User dialog box.
10 Invalid password, check the minimum password size specified for the group.
11 Invalid group. (Group may not have Runtime group option selected.)
12 Create User dialog box is already displayed, cannot display another dialog box. (For example, if the user clicked OK without providing all of the required information.)
13 Current user does not have sufficient privileges to create users (i.e., the option Edit Security System is not selected in the Security System settings).
14 The current Security Mode does not allow a user to be created.


Users created with this function have the Runtime user option selected in the User Account dialog. For more information, see Creating and configuring users.


Display the Create User dialog box on the client, to get the information from the current user:
Create a user named “Bob” in the group “Admin”, with the password “Chocolate”:
Create a user named “Albert” (full name “Albert Jones”) in the group “Engineering”, with the password “EMC2″:
  CreateUser("Albert","Engineering","EMC2","Albert Jones")