Skip to main content

Get

Returns the value of a custom property by its name.

Syntax

expression.Get(name);

expression - A variable that represents a ApiCustomProperties class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nameRequiredstringThe custom property name.

Returns

string | number | Date | boolean | null

Example

This example demonstrates how to get the value of a custom property by its name.

const doc = Api.GetDocument();
const customProps = doc.GetCustomProperties();

customProps.Add("ExistingProp", "#123456");

const existingProp = customProps.Get("ExistingProp");
const nonExistentProp = customProps.Get("NonExistentProp");

const paragraph = doc.GetElement(0);
paragraph.AddText("Existing Property Value: " + existingProp);
paragraph.AddText("\nNon-Existent Property Value: " + nonExistentProp);