Skip to Content

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

ArgumentTypeDescription
identityIdstringMailbox identity ULID. The path's {identityId}.
calendarIdstringCollection ULID or its name slug. The path's {calendarId}.
hrefstringThe object's href: its filename segment within the collection (e.g. 1a2b3c.ics). The path's {href}.
calendarRawBodyRaw 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:

OptionTypeSent asDescription
notifybooleanquery notifySend 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.
ifMatchstringheader if-matchMatch target ETag for optimistic concurrency
ifScheduleTagMatchstringheader if-schedule-tag-matchRFC 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
ifNoneMatchstringheader if-none-matchSet 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

StatusWhat it means
400empty_body, invalid_href, multiple_uids, unsatisfiable_recurrence (an RRULE no date after DTSTART satisfies), or validation error
401unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge
403forbidden: read-only grant
404No such collection, or mailbox not accessible
409uid_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
412precondition_failed: If-Match/If-None-Match not satisfied
413object_too_large (max 1048576 bytes)
503scheduling_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)
507scheduling_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.