getElement Method

Get an element by Id, FederationGuid, or Code

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

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 Id64String | GuidString | 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.

Defined in

Last Updated: 18 November, 2020