insertAspect Method

Deprecated  in 5.1.9 - will not be removed until after 2026-08-04. Use EditTxn.insertAspect instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.

Insert a new ElementAspect into the iModel.

insertAspect(aspectProps: ElementAspectProps): string

@throws IModelError if unable to insert the ElementAspect.

@returns the id of the newly inserted aspect.

@note Aspect Ids may collide with element Ids, so don't put both in a container like Set or Map use EntityReference for that instead.

Parameter Type Description
aspectProps ElementAspectProps The properties of the new ElementAspect.

Returns - string

the id of the newly inserted aspect.

Defined in

Last Updated: 05 May, 2026