跳到主要内容

GetId

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

Syntax

expression.GetId();

expression - A variable that represents a ApiProtectedRangeUserInfo class.

Parameters

This method doesn't have any parameters.

Returns

string | null

Example

This example changes the user protected range.

let worksheet = Api.GetActiveSheet();
worksheet.AddProtectedRange("protectedRange", "$A$1:$B$1").AddUser("userId", "name", "CanView");
let protectedRange = worksheet.GetProtectedRange("protectedRange");
let userInfo = protectedRange.GetUser("userId");
let userId = userInfo.GetId();
worksheet.GetRange("A3").SetValue("Id: " + userId);