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 presentation = Api.GetPresentation();
const customProps = presentation.GetCustomProperties();

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

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

const fill = Api.CreateSolidFill(Api.CreateRGBColor(150, 200, 150));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape('rect', 300 * 36000, 100 * 36000, fill, stroke);
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
slide.AddObject(shape);

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