calendarObjects.put
Create or replace calendar object.
Creates or updates a calendar object from raw text/calendar text or JSCalendar JSON (RFC 8984).
openemail.calendarObjects.put(
identityId: string,
calendarId: string,
href: string,
calendar: RawBody,
options?: CalendarObjectsPutOptions,
): ApiPromise<PimPutResult>It calls PUT /identities/{identityId}/calendars/{calendarId}/objects/{href}: Create or replace calendar object in the API reference.
Example
const pimPutResult = await openemail.calendarObjects.put(identityId, calendarId, href, calendar)Arguments
| Argument | Type | Description |
|---|---|---|
identityId | string | Mailbox identity ULID. The path's {identityId}. |
calendarId | string | Collection ULID or its name slug. The path's {calendarId}. |
href | string | The object's href: its filename segment within the collection (e.g. 1a2b3c.ics). The path's {href}. |
calendar | RawBody | Raw iCalendar or vCard text. The request's body, as bytes: text, a Blob, an ArrayBuffer or a Uint8Array (raw bodies). |
Options
The last argument, options, a CalendarObjectsPutOptions, takes:
| Option | Type | Sent as | Description |
|---|---|---|---|
notify | boolean | query notify | Send iTIP scheduling messages for this write: 'true' cancels as organizer or declines as attendee, 'false' sends nothing. Absent keeps the default — organizers schedule, attendees stay silent. |
ifMatch | string | header if-match | Match target ETag for optimistic concurrency |
ifScheduleTagMatch | string | header if-schedule-tag-match | RFC 6638 §3.2.10.1 — match the target's Schedule-Tag. Unlike the ETag this does not move when an arriving REPLY patches PARTSTAT into the stored copy, so an organizer's client can still write conditionally after its attendees answer. Sent together with If-Match, BOTH must validate |
ifNoneMatch | string | header if-none-match | Set to '*' to only create if resource does not exist |
Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).
Answer
Awaited, it is the API's JSON, PimPutResult. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.
Errors
| Status | What it means |
|---|---|
400 | empty_body, invalid_href, multiple_uids, unsatisfiable_recurrence (an RRULE no date after DTSTART satisfies), or validation error |
401 | unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge |
403 | forbidden: read-only grant |
404 | No such collection, or mailbox not accessible |
409 | uid_conflict: the href holds a different UID, or the UID already lives at another href (conflictHref names it); unsupported_component: the calendar does not accept the object's component |
412 | precondition_failed: If-Match/If-None-Match not satisfied |
413 | object_too_large (max 1048576 bytes) |
503 | scheduling_unavailable: preparation could not complete; no mutation committed. Or temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description) |
507 | scheduling_backlog_full, too_many_objects (collection or store object cap) or store_full (the store's 268435456-byte total would be exceeded) |
A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.
Types
It names these types of the API, each on a page of its own: PimPutResult.