Skip to main content

GetUser

Returns an object that represents a user from the current protected range.

Syntax

expression.GetUser(sId);

expression - A variable that represents a ApiProtectedRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sIdRequiredstringThe user ID.

Returns

ApiProtectedRangeUserInfo | null

Example

This example changes the user protected range.

var oWorksheet = Api.GetActiveSheet();
oWorksheet.AddProtectedRange("protectedRange", "$A$1:$B$1").AddUser("userId", "name", "CanView");
var protectedRange = oWorksheet.GetProtectedRange("protectedRange");
var userInfo = protectedRange.GetUser("userId");
var userName = userInfo.GetName();
oWorksheet.GetRange("A3").SetValue("User name: " + userName);