API Reference

The API is accessible via the ECM() factory and is split into the following namespaces:

Namespace Description Reference

ecm.dms

Folder, register, and document operations

→ ecm.dms

ecm.security

User and group management

→ ecm.security

ecm.system

Server metadata and object definitions

→ ecm.system

ecm.db

Direct SQL access via ADO

→ ecm.db

ecm.portfolio

Portfolios ("Mappen") and their content

→ ecm.portfolio

1. ECM factory

from ecmind_blue_client.ecm import ECM
from ecmind_blue_client.pool import SyncPoolClient

client = SyncPoolClient(servers="<host>:4000:1", username="<username>", password="<password>")
ecm = ECM(client)

The ECM() function is overloaded: passing a SyncPoolClient returns ECMSync; passing an AsyncPoolClient returns ECMAsync.

2. impersonate()

ecm.impersonate(
    username: str | None = None,
    *,
    user_guid: str | None = None,
    user_id: int | None = None,
) -> ECMSync | ECMAsync

Returns a new ECM instance that injects the given user context into every request. The target user can be identified in three ways, each mapping to its own server parameter:

Argument Server parameter

username

$SwitchContextUserName$

user_guid

$SwitchContextUserGUID$

user_id

$SwitchContextUserID$

Exactly one of the three must be given, otherwise ValueError is raised. A str is always treated as a user name, never as a GUID — user names may consist of digits or look like a GUID, so GUIDs must be passed explicitly via user_guid.

The executing user requires the Context Switch system role.

Supports both direct usage and use as a context manager (with / async with).

  • Sync

  • Async

with ecm.impersonate("john") as ecm_john:
    ecm_john.dms.insert(MyFolder(Title="Test"))
async with ecm.impersonate("john") as ecm_john:
    await ecm_john.dms.insert(MyFolder(Title="Test"))

Identification by GUID or numeric ID works the same way:

ecm_john = ecm.impersonate(user_guid="8A1D1F2E4C7B4A9E8F0D3C5B7A9E1D2F")
ecm_john = ecm.impersonate(user_id=42)