getElement Method

Get an element by Id, FederationGuid, or Code

getElement<T extends Element>(elementId: string | Code | ElementLoadProps, elementClass?: EntityClassType<Element>): T

@throws IModelError if the element is not found, cannot be loaded, or fails validation when elementClass is specified.

@see tryGetElement

Parameter Type Description
elementId string | Code | ElementLoadProps either the element's Id, Code, or FederationGuid, or an ElementLoadProps
elementClass EntityClassType<Element> Optional class to validate instance against. This parameter can accept abstract or concrete classes, but should be the same as the template (T) parameter.

Returns - T

Defined in

Last Updated: 21 November, 2024