UnblockUser
- Last UpdatedOct 29, 2026
- 2 minute read
UnblockUser is a built-in function that unblocks a previously blocked user.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
UnblockUser |
Security |
Synchronous |
No |
Supported |
Supported |
Supported |
Supported |
Supported |
Syntax
UnblockUser(strUserName)
UnblockUser ( strUserName )
strUserName
The name of the user to unblock.
Return value
This function returns one of the following possible values:
|
Value |
Description |
|---|---|
|
0 |
Success; the specified user is unblocked. |
|
1 |
Invalid number of parameters. |
|
2 |
Wrong parameter type. |
|
3 |
The specified user does not exist. |
|
4 |
The current user does not have sufficient privileges to make changes (that is, the current user does not belong to a group that has the Edit Security System option selected). |
|
5 |
The operation on the distributed security system failed. |
|
6 |
N/A |
|
7 |
The current security mode does not allow user to be blocked/unblocked. |
|
8 |
Internal error. |
Notes
When this function is used to unblock a user, the User is blocked option is cleared in the account settings for that user. For more information, see Blocking or unblocking a user.
You should avoid calling this function too frequently during project run time — for example, as part of a For loop that repeats in a matter of milliseconds. By default, the security settings are saved synchronously (that is, after each change is made), and too frequent saves can decrease runtime performance and/or cause the project development environment to freeze.
As a workaround, you can change the default behavior and configure your project to save the security settings asynchronously, at a specified interval. To do this, manually edit your project file (<project name>.app) to add the following settings:
[SecuritySystem]
EnableAsyncSavingForBuiltInFunctions=1
[Options]
SecuritySystemAutoSaveInterval=<in minutes, default is 5, minimum is 1>
Asynchronous saving applies to the following built-in functions:
-
BlockUser
-
CreateUser
-
RemoveUser
-
SetPassword
-
SetUserGroup
-
UnblockUser
If you enable asynchronous saving as described above and then call any of these functions to make changes to the security settings during project run time, those changes will be applied immediately but they might not be saved when the project is stopped.
In contrast, if you use the project development environment to make changes to the security settings during project run time, those changes are always saved synchronously regardless of whether asynchronous saving is enabled.
Examples
Unblock the user named Bob:
UnblockUser("Bob")
Unblock the user named in position 3 of the array badUsers:
UnblockUser(badUsers[3])