get_object_type_by_id()

Resolves the numeric object type ID for a given ECM object ID using dms.GetObjectTypeById. Useful when only the object ID is known but the type is required — for example before calling delete() or move() with a plain integer ID.

1. Signature

  • Sync

  • Async

ecm.dms.get_object_type_by_id(object_id: int) -> int
await ecm.dms.get_object_type_by_id(object_id: int) -> int

2. Parameters

Parameter Type Description

object_id

int

Numeric ID of the ECM object to look up.

3. Return value

The numeric object type ID associated with the given object_id.

4. Exceptions

Exception Condition

ECMNotFoundException

No object with the given object_id exists on the server.

5. Examples

5.1. Resolve the type of an object by ID

  • Sync

  • Async

type_id = ecm.dms.get_object_type_by_id(12345)
print(type_id)
type_id = await ecm.dms.get_object_type_by_id(12345)
print(type_id)

5.2. Use with delete() when only the ID is known

  • Sync

  • Async

object_id = 12345
object_type_id = ecm.dms.get_object_type_by_id(object_id)
ecm.dms.delete(object_id, object_type_id)
object_id = 12345
object_type_id = await ecm.dms.get_object_type_by_id(object_id)
await ecm.dms.delete(object_id, object_type_id)

5.3. Resolve and look up in the object definition

  • Sync

  • Async

object_id = 12345
type_id = ecm.dms.get_object_type_by_id(object_id)
definition = ecm.system.definition()
obj_def = definition[type_id]
print(obj_def.internal_name, obj_def.maintype)
object_id = 12345
type_id = await ecm.dms.get_object_type_by_id(object_id)
definition = await ecm.system.definition()
obj_def = definition[type_id]
print(obj_def.internal_name, obj_def.maintype)

6. See also

  • get() — Load a single object by ID

  • delete() — Delete an object by ID and type

  • definition() — Resolve object type definitions