AddUser
Sets a user to the current protected range.
Syntax
expression.AddUser(sId, sName, protectedRangeUserType);
expression
- A variable that represents a ApiProtectedRange class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
sId | Required | string | The user ID. | |
sName | Required | string | The user name. | |
protectedRangeUserType | Required | ProtectedRangeUserType | The user type of the protected range. |
Returns
ApiProtectedRangeUserInfo | null
Example
This example adds the the user for protected range.
- Code
- Result
// How to open an access for the protected range to user specifing user id, name and access type.
// Get an active sheet, add protected range to it and add user with rights.
let worksheet = Api.GetActiveSheet();
worksheet.AddProtectedRange("protectedRange", "$A$1:$B$1");
let protectedRange = worksheet.GetProtectedRange("protectedRange");
protectedRange.AddUser("userId", "name", "CanView");