GetAllUsers
Returns all users from the current protected range.
Syntax
expression.GetAllUsers();
expression
- A variable that represents a ApiProtectedRange class.
Parameters
This method doesn't have any parameters.
Returns
ApiProtectedRangeUserInfo[] | null
Example
This example gets all users of a protected range.
- Code
- Result
// How to get an array of users of a protected range.
// Get an active sheet, add protected range to it and diplay its first user.
let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A1").SetValue("1");
worksheet.GetRange("B1").SetValue("2");
worksheet.GetRange("C1").SetValue("3");
worksheet.AddProtectedRange("Protected range", "$A$1:$C$1");
let protectedRange = worksheet.GetProtectedRange("Protected range");
protectedRange.AddUser("uid-1", "John Smith", "CanEdit");
protectedRange.AddUser("uid-2", "Mark Potato", "CanView");
let users = protectedRange.GetAllUsers();
worksheet.GetRange("A3").SetValue(users[0].GetName());