Skip to main content

GetLock

Returns the lock type of the current container.

Syntax

expression.GetLock();

expression - A variable that represents a ApiBlockLvlSdt class.

Parameters

This method doesn't have any parameters.

Returns

SdtLock

Example

Get the lock type of the container in a document.

// Create a block content control, set its lock to "sdtContentLocked", and return the lock type to insert it into the second paragraph of the document.

// How to get the lock type of the block-level content control object in a document.

let doc = Api.GetDocument();
let blockLvlSdt = Api.CreateBlockLvlSdt();
blockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control with the content lock set to it.");
blockLvlSdt.SetLock("sdtContentLocked");
doc.AddElement(0, blockLvlSdt);
doc.GetElement(1).AddText("Lock type: " + blockLvlSdt.GetLock());