insertElement Method
Insert a new element into the iModel.
insertElement(elProps: ElementProps, options?: InsertElementOptions): string
@returns The newly inserted element's Id.
@throws ITwinError if unable to insert the element.
@note  For convenience, the value of elProps.id is updated to reflect the resultant element's id.
However when elProps.federationGuid is not present or undefined, a new Guid will be generated and stored on the resultant element. But
the value of elProps.federationGuid is not updated. Generally, it is best to re-read the element after inserting (e.g. via IModelDb.Elements.getElementProps)
if you intend to continue working with it. That will ensure its values reflect the persistent state.
| Parameter | Type | Description | 
|---|---|---|
| elProps | ElementProps | The properties of the new element. | 
| options | InsertElementOptions | 
Returns - string
The newly inserted element's Id.
Defined in
- core/backend/src/IModelDb.ts Line 2309
Last Updated: 24 October, 2025