create()

Creates a portfolio and returns it, fully read back, as ECMPortfolio.

1. Signature

  • Sync

  • Async

ecm.portfolio.create(*, creator: str | None = None, recipient: str | None = None,
                     subject: str | None = None,
                     objects: Iterable[ECMPortfolioObjectLike] | None = None,
                     object_type_id: int | None = None,
                     reuse_existing: bool = False) -> ECMPortfolio
await ecm.portfolio.create(...) -> ECMPortfolio

2. Parameters

Parameter Type Default Description

creator

str | None

None

Login name of the creator.

recipient

str | None

None

Login name of the recipient, for a portfolio handed to someone else.

subject

str | None

None

Title of the portfolio. The backing column holds 32 characters; what happens to longer values is up to the server.

objects

Iterable | None

None

Initial content. Accepted are ECMPortfolioObject, (id, type_id) pairs and model instances.

object_type_id

int | None

None

Restrict the portfolio to this object type. The server then rejects members of other types.

reuse_existing

bool

False

True returns the existing portfolio for recipient/subject instead of creating a second one with the same title (Mode=0).

3. Returns

The created or reused ECMPortfolio.

Subject, recipient and object type of an existing portfolio cannot be changed later, the server API has no job for it. Renaming means deleting and creating anew.

4. Errors

ECMException when the server reports no usable portfolio ID.

5. Example

portfolio = ecm.portfolio.create(
    creator="ROOT",
    recipient="ROOT",
    subject="Follow-up week 34",
    objects=[(83, 262144)],
)
print(portfolio.id, portfolio.created)

# Idempotent: only the first call creates
portfolio = ecm.portfolio.create(recipient="ROOT", subject="Follow-up", reuse_existing=True)