GetId
Gets a unique ID for the current content control.
Syntax
expression.GetId();
expression
- A variable that represents a ApiInlineLvlSdt class.
Parameters
This method doesn't have any parameters.
Returns
string
Example
This example shows how to get the ID of the container.
- Code
- Result
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let inlineLvlSdt = Api.CreateInlineLvlSdt();
let run = Api.CreateRun();
run.AddText("This is an inline text content control with an ID set to it.");
inlineLvlSdt.AddElement(run, 0);
inlineLvlSdt.SetId("4815162342");
paragraph.AddInlineLvlSdt(inlineLvlSdt);
let contentControlId = inlineLvlSdt.GetId();
paragraph = Api.CreateParagraph();
paragraph.AddText("Id: " + contentControlId);
doc.Push(paragraph);