ApiProtectedRangeUserInfo

new ApiProtectedRangeUserInfo()

Class representing a user from the current protected range.

Methods

Name Description
GetId

Returns the ID property of the current user's information.

GetName

Returns the name property of the current user's information.

GetType

Returns the type property of the current user's information.

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A1").SetValue("1");
oWorksheet.GetRange("B1").SetValue("2");
oWorksheet.GetRange("C1").SetValue("3");
oWorksheet.AddProtectedRange("Protected range", "A1:C1");
var oProtectedRange = oWorksheet.GetProtectedRange("Protected range");
oProtectedRange.AddUser("uid-1", "John Smith", "CanEdit");
oProtectedRange.AddUser("uid-2", "Mark Potato", "CanView");
var aUsers = oProtectedRange.GetAllUsers();
oWorksheet.GetRange("A3").SetValue("User name: " + aUsers[0].GetName());
oWorksheet.GetRange("A4").SetValue("User ID: " + aUsers[0].GetId());
oWorksheet.GetRange("A5").SetValue("User type: " + aUsers[0].GetType());
builder.SaveFile("xlsx", "ApiProtectedRangeUserInfo.xlsx");
builder.CloseFile();

Resulting document