getElement Method

Get an element by Id, FederationGuid, or Code

getElement<T extends Element<T>>(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 IModelDb.Elements.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: 16 April, 2024