get()
Loads a single object from the server by its ID and returns it as a typed model instance. Raises ECMNotFoundException if no object with the given ID exists.
ECM Model reference — for a full description of all system properties (system.id, system.rights, system.base_params, system.file_properties, etc.) and how change tracking works.
Two retrieval modes are available internally, differing in scope and performance — see [_retrieval_modes].
1. Signature
-
Sync
-
Async
ecm.dms.get(
model_class: type[T],
object_id: int,
object_type_id: int | None = None,
*,
rights: bool = False,
base_params: bool = False,
file_properties: bool = False,
variants: bool = False,
use_result_list: bool = False,
fields: list[str | ECMField] | None = None,
) -> T
await ecm.dms.get(
model_class: type[T],
object_id: int,
object_type_id: int | None = None,
*,
rights: bool = False,
base_params: bool = False,
file_properties: bool = False,
variants: bool = False,
use_result_list: bool = False,
fields: list[str | ECMField] | None = None,
) -> T
2. Parameters
| Name | Type | Description |
|---|---|---|
|
|
The model class of the object to load. Determines the object type and the returned fields. |
|
|
The numeric ID of the object to load. |
|
|
Optional numeric object type ID. Only evaluated in standard mode ( |
|
|
When |
|
|
When |
|
|
When |
|
|
When |
|
|
Switches the retrieval mode — see [_retrieval_modes]. Default: |
|
|
Restricts the returned fields. Only effective when |
5. Retrieval modes
get() supports two internal retrieval methods that differ in scope and constraints:
use_result_list=False (default) |
use_result_list=True |
|
|---|---|---|
Server job |
|
|
Performance |
Faster (direct ID lookup) |
Slower (query + paging) |
Document location fields |
Not available |
Available |
|
Available |
Available |
|
Not available (ignored) |
Available |
Objects without a filing location |
Can be fetched |
Raises |
|
|
6. Examples
6.1. Simple fetch
-
Sync
-
Async
folder = ecm.dms.get(InvoiceFolder, 12345)
print(folder.Title, folder.Year)
folder = await ecm.dms.get(InvoiceFolder, 12345)
print(folder.Title, folder.Year)
6.2. With error handling
-
Sync
-
Async
from ecmind_blue_client.ecm import ECMNotFoundException
try:
folder = ecm.dms.get(InvoiceFolder, 12345)
print(folder.Title)
except ECMNotFoundException:
print("Object not found")
from ecmind_blue_client.ecm import ECMNotFoundException
try:
folder = await ecm.dms.get(InvoiceFolder, 12345)
print(folder.Title)
except ECMNotFoundException:
print("Object not found")
6.3. Rights and administrative parameters
-
Sync
-
Async
folder = ecm.dms.get(InvoiceFolder, 12345, rights=True, base_params=True)
print(folder.system.rights.edit_metadata)
print(folder.system.base_params.creator)
folder = await ecm.dms.get(InvoiceFolder, 12345, rights=True, base_params=True)
print(folder.system.rights.edit_metadata)
print(folder.system.base_params.creator)
6.4. Document with file information and variants
-
Sync
-
Async
doc = ecm.dms.get(InvoiceDocument, 12345, file_properties=True, variants=True)
print(doc.system.file_properties.extension, doc.system.file_properties.size)
for v in doc.system.variants:
print(v.doc_ver, "active" if v.is_active else "")
doc = await ecm.dms.get(InvoiceDocument, 12345, file_properties=True, variants=True)
print(doc.system.file_properties.extension, doc.system.file_properties.size)
for v in doc.system.variants:
print(v.doc_ver, "active" if v.is_active else "")
6.5. Fetch document location fields (use_result_list)
folder_id and register_id are only available with use_result_list=True:
-
Sync
-
Async
doc = ecm.dms.get(InvoiceDocument, 12345, use_result_list=True)
print(doc.system.folder_id) # ID of the parent folder
print(doc.system.register_id) # ID of the parent register
doc = await ecm.dms.get(InvoiceDocument, 12345, use_result_list=True)
print(doc.system.folder_id)
print(doc.system.register_id)
6.6. Load only specific fields (use_result_list + fields)
-
Sync
-
Async
folder = ecm.dms.get(
InvoiceFolder, 12345,
use_result_list=True,
fields=[InvoiceFolder.Title, InvoiceFolder.Year],
)
print(folder.Title, folder.Year)
# folder.Status is None (not requested)
folder = await ecm.dms.get(
InvoiceFolder, 12345,
use_result_list=True,
fields=[InvoiceFolder.Title, InvoiceFolder.Year],
)
print(folder.Title, folder.Year)