search()

Searches portfolios and returns them as list[ECMPortfolio]. All criteria are optional and combine as an AND; without any criterion every portfolio visible to the session is returned.

1. Signature

  • Sync

  • Async

ecm.portfolio.search(*, portfolio_id: int | None = None, creator: str | None = None,
                     recipient: str | None = None, subject: str | None = None,
                     created: datetime | None = None, created_to: datetime | None = None,
                     object_type_id: int | None = None,
                     garbage_mode: bool = False) -> list[ECMPortfolio]
await ecm.portfolio.search(...) -> list[ECMPortfolio]

2. Parameters

Parameter Type Default Description

portfolio_id

int | None

None

ID of a single portfolio. For single access get() is more convenient.

creator

str | None

None

Login name of the creator.

recipient

str | None

None

Login name of the recipient.

subject

str | None

None

Title of the portfolio.

created

datetime | None

None

Exact creation time, read as installation wall clock.

created_to

datetime | None

None

Upper bound for the creation time. None leaves the range open (Created_to=0).

object_type_id

int | None

None

Only portfolios restricted to this object type.

garbage_mode

bool

False

True searches the recycle bin instead of the live portfolios.

3. Returns

list[ECMPortfolio], empty when nothing matches. Fields see overview.

4. Example

from datetime import datetime

# All portfolios of one creator
mine = ecm.portfolio.search(creator="ROOT")

# Find older portfolios for cleanup
old = ecm.portfolio.search(creator="ROOT", created_to=datetime(2024, 1, 1))

# Deleted portfolios in the recycle bin
deleted = ecm.portfolio.search(creator="ROOT", garbage_mode=True)

for portfolio in mine:
    print(portfolio.id, portfolio.subject, len(portfolio.objects))