AddUser

function AddUser(
  sId: string = null,
  sName: string = null,
  protectedRangeUserType: ProtectedRangeUserType = null,
): ApiProtectedRangeUserInfo | "null"

Description

Sets a user to the current protected range.

Parameters

sIdstringdefault: null

The user ID.

sNamestringdefault: null

The user name.

protectedRangeUserTypeProtectedRangeUserTypedefault: null

The user type of the protected range.

Returns

ApiProtectedRangeUserInfo | "null"

Try It

var oWorksheet = Api.GetActiveSheet();
oWorksheet.AddProtectedRange("protectedRange", "$A$1:$B$1");
var protectedRange = oWorksheet.GetProtectedRange("protectedRange");
protectedRange.AddUser("userId", "name", "CanView");

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).