Skip to Content

Restore deleted calendar.

Brings a deleted calendar back under its own id, with exactly the members that were deleted with it (members deleted individually beforehand stay in the trash, restorable once the collection is live). It comes back private: grants, feed tokens and any public listing were retired when it was deleted. For a calendar, each restored meeting this mailbox organizes is re-sent to its attendees as a REQUEST with SEQUENCE advanced by one, off the response path, unless notify=false. Owner only, write scope.

openemail.calendars.restore(
  identityId: string,
  trashedCalendarId: string,
  options?: CalendarsRestoreOptions,
): ApiPromise<PimCollectionRestored>

It calls POST /identities/{identityId}/calendars/trash/{trashedCalendarId}/restore: Restore deleted calendar in the API reference.

Example

const pimCollectionRestored = await openemail.calendars.restore(identityId, trashedCalendarId)

Arguments

ArgumentTypeDescription
identityIdstringMailbox identity ULID. The path's {identityId}.
trashedCalendarIdstringThe trashed collection's ULID (the id it had while live). The path's {trashedCalendarId}.

Options

The last argument, options, a CalendarsRestoreOptions, 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.

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, PimCollectionRestored. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.

Errors

StatusWhat it means
401unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge
404not_found: no such deleted collection of this kind, or mailbox not accessible
409name_taken: a live collection of this kind now holds the deleted one's name; rename it first
503scheduling_unavailable: preparation could not complete; nothing restored. 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_collections, or too_many_objects: the restore would exceed the admission budget

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: PimCollectionRestored.