跳到主要内容

SetAnyoneType

Sets the type of the "Anyone" user to the current protected range.

Syntax

expression.SetAnyoneType(protectedRangeUserType);

expression - A variable that represents a ApiProtectedRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
protectedRangeUserTypeRequiredProtectedRangeUserTypeThe user type of the protected range.

Returns

boolean

Example

This example changes the the user protected range.

let worksheet = Api.GetActiveSheet();
worksheet.AddProtectedRange("protectedRange", "Sheet1!$A$1:$B$1");
let protectedRange = worksheet.GetProtectedRange("protectedRange");
protectedRange.SetAnyoneType("CanView");