A CalDAV server as a library, without storage of its own. The protocol lives here; your data stays where it is and reaches the server through a small provider interface you implement.
- CalDAV (RFC 4791) and WebDAV (RFC 4918) as far as Apple Calendar, Apple Reminders, Thunderbird and DAVx⁵ need it
- Events (
VEVENT) and to-dos (VTODO), per calendar calendar-querywith time ranges, recurrence expansion and all CalDAV filters,calendar-multiget,free-busy-query; partialcalendar-data(comp/propselection,expand,limit-recurrence-set)sync-collection(RFC 6578) and CTags for cheap syncing- ETags with
If-Match/If-None-Match, read-only calendars per user - Creating, renaming, recoloring and deleting calendars from the client (
MKCALENDAR, extendedMKCOL,PROPPATCH), if the provider allows it - Scheduling (RFC 6638): invitations, replies and cancellations, free-busy
/.well-known/caldav(RFC 6764), HTTP Basic auth- Fastify plugin, and a framework-independent handler
(request) → responsefor anything else - Written in TypeScript
npm install caldav-provider-serverimport Fastify from 'fastify';
import {caldav} from 'caldav-provider-server/fastify';
import type {CalDavProvider, Principal} from 'caldav-provider-server';
interface User extends Principal {
teamIds: string[];
}
const provider: CalDavProvider<User> = {
async authenticate(username, password) {
const user = await checkAppPassword(username, password);
return user ? {id: user.id, displayName: user.name, addresses: [user.email], teamIds: user.teamIds} : null;
},
async listCalendars(user) {
return user.teamIds.map((teamId) => ({
id: teamId,
displayName: teamName(teamId),
components: ['VEVENT'],
syncToken: String(lastChange(teamId)),
readOnly: !canEdit(user, teamId),
}));
},
async listObjects(user, calendar, query) {
return (await loadEvents(calendar.id, query.timeRange)).map(toObject);
},
async getObject(user, calendar, name) {
const event = await loadEvent(calendar.id, name.replace(/\.ics$/, ''));
return event ? toObject(event) : null;
},
// optional: changesSince, putObject, deleteObject, scheduling
};
const app = Fastify();
await app.register(caldav, {provider, basePath: '/dav'});
await app.listen({port: 3000});toObject turns one of your records into {name, etag, ics, lastModified?}, for example with
ical-generator for events and
ical-vtodo-generator for to-dos. One object holds one event or
to-do (with all its overridden occurrences), so generate one VCALENDAR per record.
The plugin registers its routes below basePath and at /.well-known/caldav. Register it without Fastify's
prefix option, the well-known URL has to stay at the root. It is encapsulated: its content type parsers (everything is
read as text) do not affect the rest of your app. If you use @fastify/cors or another plugin that answers OPTIONS,
exclude the CalDAV paths from it.
import {createCalDavHandler, CALDAV_METHODS} from 'caldav-provider-server';
const handle = createCalDavHandler({provider, basePath: '/dav'});
// in any HTTP server, for every method in CALDAV_METHODS:
const res = await handle({method: req.method, url: req.url, headers: req.headers, body: rawBodyAsString});
// res: {status, headers, body?}| URL | What |
|---|---|
/.well-known/caldav |
redirects to /dav/ |
/dav/ |
entry point, tells the client its principal |
/dav/principals/{principal}/ |
the user |
/dav/calendars/{principal}/ |
calendar home, lists listCalendars() |
/dav/calendars/{principal}/{calendar}/ |
one calendar |
/dav/calendars/{principal}/{calendar}/{name} |
one object (name usually {uid}.ics) |
/dav/inbox/{principal}/, /dav/outbox/{principal}/ |
scheduling, only with a scheduling provider |
Users only see their own URLs. Shared calendars (team calendars, for example) appear in the home of every user who
gets them from listCalendars(), with the same calendar id.
All methods are async. Throw a CalDavError to answer with a specific status
(CalDavError.forbidden(), CalDavError.preconditionFailed(), CalDavError.uidConflict(), …); any other error
becomes a 500 and is passed to onError.
| Method | Required | What it does |
|---|---|---|
authenticate(username, password) |
yes | HTTP Basic check, returns the principal or null |
listCalendars(principal) |
yes | calendars the user can see |
listObjects(principal, calendar, query) |
yes | objects of a calendar |
getObject(principal, calendar, name) |
yes | one object or null |
getObjects(principal, calendar, names) |
no | batch for calendar-multiget, defaults to getObject per name |
changesSince(principal, calendar, token) |
no | changes for sync-collection, null for unknown tokens |
putObject(principal, calendar, input) |
no | create or replace; without it everything is read-only |
deleteObject(principal, calendar, input) |
no | delete |
moveObject(principal, from, to, input) |
no | MOVE to another calendar (Apple Calendar moves events so) |
updateCalendar(principal, calendar, changes) |
no | PROPPATCH: name, color, order, description, see below |
createCalendar(principal, id, calendar) |
no | MKCALENDAR / extended MKCOL: a new calendar |
deleteCalendar(principal, calendar) |
no | DELETE of a whole calendar |
moveCalendar / copyCalendar(principal, calendar, newId) |
no | MOVE (new id) / COPY (duplicate) of a whole calendar |
scheduling |
no | enables RFC 6638, see below |
searchPrincipals(principal, query) |
no | other users to find, e.g. to invite them, see below |
getPrincipal(principal, id) |
no | another user by id, for a PROPFIND on their principal URL |
delegations(user) |
no | whose calendars the user may use "on behalf of", see below |
delegates(principal), setDelegates(…) |
no | the principal's delegates, shown and changed by clients |
sharing |
no | sharing calendars from the client (Apple Calendar), see below |
properties |
no | storage for properties clients set (e.g. default alarms) |
updatePrincipal(principal, changes) |
no | the user renames themselves (displayname of the principal) |
publishing |
no | public read-only feeds ("Public Calendar"), see below |
attachments |
no | managed attachments (RFC 8607), see below |
locks |
no | LOCK / UNLOCK storage, see below |
interface Principal {
id: string; // URL-safe, stable
displayName?: string;
addresses?: string[]; // 'jane@example.com' or 'mailto:jane@example.com', needed for scheduling
}Extend it with whatever you need; the same object comes back in every call.
interface Calendar {
id: string; // URL-safe, unique among the user's calendars
displayName: string;
description?: string;
color?: string; // '#RRGGBB' or '#RRGGBBAA'
order?: number;
components: ('VEVENT' | 'VTODO')[];
syncToken: string; // changes whenever an object changes; also used as CTag
readOnly?: boolean;
timezone?: string; // VCALENDAR with a VTIMEZONE, for floating times
}components decides where the calendar shows up: Apple Reminders lists only calendars with VTODO, Apple Calendar
those with VEVENT. Clients cope best with one type per calendar, so offer to-dos as calendars of their own.
syncToken can be anything that changes with every change in the calendar: a counter, the latest updated_at, a hash.
interface CalendarObject {
name: string; // last URL segment, e.g. 'b3f1….ics'
etag: string; // changes with the content
ics: string; // complete VCALENDAR
lastModified?: Date;
scheduleTag?: string;
}listObjects gets a query with componentType and timeRange when the client asked for them. It is a hint for your
database query: the server filters the result exactly afterwards (including recurrences), so returning too much is
fine, returning too little is not. Recurring events must be returned if any occurrence can fall into the range.
async putObject(user, calendar, {name, uid, ics, componentType, isNew, ifMatch}) {
// parse ics, store it, return the new ETag
return {etag};
}The server checks the calendar data (one component type, one UID, type allowed in this calendar), the privileges and
If-Match / If-None-Match before it calls putObject. Check ifMatch again in your transaction if you can, and
throw CalDavError.preconditionFailed() if it does not match.
Clients choose the object name when they create something, and it does not have to be {uid}.ics. Keep the name
together with the record, or throw CalDavError.forbidden() for names you cannot store.
If you store exactly the ICS you got, return storedAsIs: true and the client keeps its copy. If you store your own
format and generate the ICS anew, leave it out: the client then fetches the object again
(RFC 4791 5.3.4), and properties you do not store are gone.
Objects can be limited in size with the maxObjectSize option (bytes), or per calendar with maxResourceSize. Larger
PUTs answer 403 max-resource-size, and clients see the limit as max-resource-size of the calendar. Inline
attachments count, managed ones (below) don't.
A calendar is read-only for a user if readOnly is set or putObject / deleteObject is missing. The server then
answers PUT/DELETE with 403 and reports only read privileges, so clients show the calendar as read-only.
Without changesSince clients still work: every sync-collection with a token answers 403 valid-sync-token and the
client does a full sync, which costs a request with all ETags per calendar. With it:
async changesSince(user, calendar, token) {
const changes = await loadChangesSince(calendar.id, Number(token));
if (!changes) return null; // token unknown or too old
return {syncToken: String(changes.version), changed: changes.updated.map(toObject), deleted: changes.deletedNames};
}Deleted objects need a tombstone (name and version) for as long as clients may come back with an old token.
Clients rename and recolor calendars with PROPPATCH, create them with MKCALENDAR (Apple, DAVx⁵) or extended
MKCOL (RFC 5689) and delete them with DELETE. Each needs its hook; without
it the request answers 403 and the client keeps its old state.
async updateCalendar(user, calendar, {displayName, color, order, description}) {
// only the properties of the request are set; null means the client removed one
await db.calendars.update(calendar.id, {name: displayName, color, order, description});
},
async createCalendar(user, id, {displayName, color, order, description, components, timezone}) {
// id is the URL segment the client chose (often a UUID); listCalendars must return it afterwards
await db.calendars.insert({id, owner: user.id, name: displayName, color, order, description, components});
},
async deleteCalendar(user, calendar) {
await db.calendars.delete(calendar.id);
},PROPPATCHhandlesdisplayname,calendar-color(#RRGGBBor#RRGGBBAA),calendar-order,calendar-description,calendar-timezone(astimezone) andschedule-calendar-transp(astransparent; events of transparent calendars don't count in free-busy lookups). Other properties answer 403, invalid values 409. The update is atomic (RFC 4918 9.2): if one property fails, the others answer 424 andupdateCalendaris not called. ACalDavErroryou throw sets the status of every property.readOnlycalendars can't be changed or deleted; the server answers 403 without calling the provider. Writable calendars report thewrite-propertiesprivilege, the calendar homebind/unbindwhen the hooks exist.MOVEof a calendar to/calendars/<principal>/<new id>/callsmoveCalendar(a rename of the URL),COPYcallscopyCalendar. The destination must not exist; read-only calendars can be copied but not moved. Clients rarely do this; generic WebDAV tools do.MKCALENDARtakes the same properties and also accepts what clients send along:calendar-timezone-id(ignored) andsupported-calendar-component-set, of whichVJOURNALis dropped as long asVEVENTorVTODOremains. Without a component set the calendar getsVEVENTandVTODO. If a property can't be set, nothing is created (403 withmkcalendar-response/mkcol-response).- Change the calendar's
syncTokenwhen its properties change too, so the next homesync-collectionreports the calendar to the user's other devices.
With a scheduling provider, the server does implicit scheduling as described in RFC 6638:
- The organizer saves an event with attendees →
REQUESTto all attendees. Changes to time, place, title, description, recurrence or status send a newREQUEST; removed attendees get aCANCEL; deleting the event cancels it for everybody. - An attendee changes the own participation status →
REPLYto the organizer. Deleting the event declines it (unless the client sendsSchedule-Reply: F). SCHEDULE-STATUSis written back to the organizer's copy,SCHEDULE-AGENT=CLIENTis respected.POSTto the outbox: free-busy queries (Apple's availability view) and messages of clients that schedule themselves.
You deliver the messages:
import {processSchedulingMessage} from 'caldav-provider-server';
const scheduling: SchedulingProvider<User> = {
async deliver({method, uid, recipients, ics, sender}) {
const result = {};
for (const recipient of recipients) {
const user = await findUserByEmail(recipient);
if (!user) {
await sendInvitationMail(recipient, ics); // iMIP, if you want
result[recipient] = '1.1'; // sent
continue;
}
const existing = await findEventByUid(user, uid);
const {ics: updated} = processSchedulingMessage(ics, existing?.ics ?? null, recipient);
if (updated) await saveEvent(user, uid, updated);
result[recipient] = '1.2'; // delivered
}
return result;
},
async findPrincipal(address) {
return findUserByEmail(address); // for free-busy
},
};processSchedulingMessage(itip, existing, recipient) applies a message to the recipient's copy the way a CalDAV server
with automatic processing does: a REQUEST creates or updates the event (own participation status and alarms survive
updates without a new SEQUENCE), a CANCEL marks it cancelled, a REPLY updates the attendee's status in the
organizer's copy.
Status codes per recipient: 1.1 sent (e.g. by mail), 1.2 delivered, 3.7 unknown user, 5.1 could not deliver,
5.3 the user cannot receive invitations. Free-busy answers for every user that findPrincipal returns; return null
for users whose availability others must not see.
If your availability data lives elsewhere (absences, working hours) or depends on who asks, implement freeBusy
instead. It takes precedence over findPrincipal:
async freeBusy(requester, address, {start, end}, maskUid) {
if (!sharesATeam(requester, address)) return null; // answered 3.7
return (await busyTimes(address, start, end, maskUid)).map(b => ({start: b.from, end: b.to, type: b.maybe ? 'BUSY-TENTATIVE' : 'BUSY'}));
},Periods are clipped to the asked range; maskUid is the event being planned (Apple's X-CALENDARSERVER-MASK-UID).
Scheduling inbox: Clients get messages through the server's automatic processing, not through the inbox, so the inbox
is empty unless you implement listInbox / deleteInboxItem.
Calendar apps suggest attendees while you type: Apple with calendarserver-principal-search, others with
principal-property-search. Implement searchPrincipals to answer with the users the principal may invite; the client
then puts their address in the event, which your scheduling provider recognizes:
async searchPrincipals(principal, {terms, test, limit}) {
const users = await usersVisibleTo(principal, terms, test === 'allof', limit ?? 50);
return users.map(u => ({id: u.id, displayName: u.name, addresses: [`mailto:${u.email}`]}));
},Results answer displayname, calendar-user-address-set, email-address-set, principal-URL and calendar-user-type.
Without it, a search only finds the signed-in user (Thunderbird looks itself up that way) and no searchable properties
are offered.
Clients sometimes read a found user's principal URL afterwards. getPrincipal(principal, id) returns the same shape
as a search result, or null for users the principal may not see (404); without it such URLs answer 403.
A delegate uses another user's calendars "on behalf of" them (CalendarServer's calendar-proxy model, which Apple
Calendar shows as "Delegates" / "Accounts I can access"). delegations(user) says whose calendars the user may use:
async delegations(user) {
const rows = await db.delegations.where({delegate: user.id});
return rows.map(r => ({principal: toPrincipal(r.owner), write: r.canWrite}));
},- The user's principal reports
calendar-proxy-read-for/calendar-proxy-write-forandgroup-membership, andexpand-propertyresolves them to the owners' names and addresses. - Requests below
/calendars/<owner>/,/inbox/<owner>/,/outbox/<owner>/and/principals/<owner>/run as the owner: every provider method gets the owner's principal,current-user-principalstays the signed-in user. Read delegates can't write, create, delete or schedule; write delegates are still limited byreadOnlyof each calendar. Changes a write delegate makes are scheduled as the owner. - With
delegates(principal)the principal has two proxy groups,/principals/<id>/calendar-proxy-read/andcalendar-proxy-write/, whosegroup-member-setlists the delegates. WithsetDelegates(principal, write, ids)the client can change them (PROPPATCH ofgroup-member-set).
Calendars shared in your backend simply show up in listCalendars of every member. To let users share from Apple
Calendar too (CalendarServer's sharing model: "Share Calendar…", invitations, accept/decline), add a sharing
provider:
const sharing: SharingProvider<User> = {
async sharees(user, calendar) {
return db.shares(calendar.id).map(s => ({address: `mailto:${s.email}`, displayName: s.name, access: s.access, status: s.status}));
},
async share(user, calendar, {set, remove}) {
// invite, change access, remove; throw CalDavError for addresses you can't share with
},
async invitations(user) {
// invitations to the user: {id, owner, calendarId, address, access, status, summary?}
},
async replyToInvitation(user, id, accept) {
// return the id the calendar has in listCalendars(user) once accepted
},
async dismissInvitation(user, id) {},
};- Mark calendars in
listCalendars:shared: trueon the owner's shared calendar,sharedBy(the owner) on a calendar the user sees through a share. Apple shows them accordingly;sharedBycalendars can't be shared further. - The owner POSTs
CS:shareto the calendar; the calendar'sCS:invitelists the sharees with their status. - Invitations appear in the user's notification collection (
/notifications/<id>/, announced asCS:notification-URL) withsync-collectionsupport. The invitee POSTsCS:invite-replyto the calendar home, which callsreplyToInvitation;DELETEof a notification callsdismissInvitation.
Clients that follow the WebDAV resource sharing draft (draft-pot-webdav-resource-sharing) can share through the same
provider: POST of DAV:share-resource maps onto share (no-access removes a sharee), and calendars report
DAV:share-access and DAV:invite. Invitations of that draft's notification format are not sent; invitees answer
through the CalendarServer notifications above or your own UI.
Clients also set properties the server doesn't know, e.g. Apple Calendar's default alarms on the calendar home
(default-alarm-vevent-date, default-alarm-vevent-datetime), which it sends on every start. With a properties
store they are kept and returned on the home, calendars, objects and the principal (WebDAV "dead properties"):
const properties: PropertyStore<User> = {
async get(user, path) {
return db.props.get(path) ?? {}; // {'{urn:ietf:params:xml:ns:caldav}default-alarm-vevent-date': 'BEGIN:VALARM…'}
},
async set(user, path, changes) {
await db.props.merge(path, changes); // a null value removes the property
},
};Values are the property's content as XML text, so nested elements keep their namespaces. Properties the server
computes itself (getetag, resourcetype, …) stay protected (403). A PROPPATCH that mixes calendar properties and
stored ones is checked as a whole, then updateCalendar and set are called in that order. Delete stored properties
together with the resource if you like; the server doesn't. updatePrincipal(principal, {displayName}) lets the user
rename themselves.
Apple Calendar's "Public Calendar" switch publishes a read-only feed (CalendarServer CS:publish-calendar). The
URL is yours: return any absolute URL, e.g. a feed you already serve elsewhere.
const publishing: PublishingProvider<User> = {
async publishedUrl(user, calendar) {
return feeds.urlOf(calendar.id); // or null when not published
},
async publish(user, calendar) {
return feeds.create(calendar.id); // e.g. 'webcal://feeds.example.com/<signed token>.ics'
},
async previewUrl(user, calendar) {
return feeds.urlFor(calendar.id); // optional: the URL it would get, shown before publishing
},
async unpublish(user, calendar) {}, // optional; without it, switching off is accepted and nothing happens
};Calendars then offer can-be-published and report CS:publish-url (when published) and CS:pre-publish-url
(the published URL, else previewUrl). Apple Calendar shows pre-publish-url as the calendar's public URL, so
return it: without it Apple shows "null". Publishing answers 202 like iCloud; the client then reads the URL with
PROPFIND. Change the calendar's syncToken when it is published or unpublished, so other devices notice. Read-only calendars and calendars shared with
the user can't be published. Optionally the server serves the feed itself, without login, at
<basePath>/public/<token> (.ics may be appended): implement resolveFeed(token) returning the owner and the
calendar, and return such URLs from publish. The feed is one VCALENDAR with all objects, their time zones and
X-WR-CALNAME.
With an attachments provider, clients upload files to events and to-dos (RFC 8607
managed attachments, as Apple Calendar does). The provider stores the bytes; the server keeps the ATTACH properties
of the object up to date (MANAGED-ID, FILENAME, SIZE, FMTTYPE, URL) and stores the object with putObject.
const attachments: AttachmentProvider<User> = {
async add(user, calendar, objectName, {filename, contentType, data}) {
return (await blobs.put({calendar: calendar.id, objectName, filename, contentType, data})).id;
},
async update(user, calendar, objectName, managedId, input) {
return (await blobs.replace(managedId, input)).id; // a new id, as RFC 8607 asks
},
async remove(user, calendar, objectName, managedId) {
await blobs.delete(managedId);
},
async get(user, managedId) {
return blobs.readIfVisibleTo(user, managedId); // {filename, contentType, data} or null
},
maxSize: 20 * 1024 * 1024,
};POST <object>?action=attachment-add(optionally&rid=for single instances,Mfor the master),attachment-update&managed-id=…andattachment-remove&managed-id=…. Deleting an object removes its attachments.- Files are downloaded from
/dav/attachments/<principal>/<managed-id>. The URL inATTACHis absolute; set theoriginoption (e.g.https://cal.example.com) when the server runs behind a proxy, otherwise it is built fromX-Forwarded-ProtoandHost. - Request bodies may be bytes (
Uint8Array/Buffer); the Fastify plugin passes them through. Attachment downloads answer with bytes asbody.
DAVx⁵ can be notified of changes right away instead of polling, with
WebDAV-Push over Web Push (VAPID, RFC 8292, and aes128gcm encryption,
RFC 8291; implemented with node:crypto, no extra dependency). Pass a WebDavPush as option:
import {generateVapidKeys, WebDavPush} from 'caldav-provider-server';
// once: const vapid = generateVapidKeys(); store {publicKey, privateKey}
const push = new WebDavPush({store: pushStore, vapid, subject: 'mailto:admin@example.com'});
await app.register(caldav, {provider, push, origin: 'https://cal.example.com'});- Calendars and the calendar home report
transports(with the VAPID public key),topicandsupported-triggers(content updates with depth 1, property updates of calendars with depth 0); theDAVheader haswebdav-push. - Clients register with
POST push-register(201 or 204 withLocationandExpires, at mostmaxExpiration, default 7 days) and unregister withDELETEof the registration URL<basePath>/push/<id>. - Changes through CalDAV (
PUT,DELETE,MOVE,COPY, attachments,PROPPATCHof a calendar, new or removed calendars) send a push message in the background, with the newsync-token.Push-Dont-Notifyis respected. - Changes in your backend: call
push.notifyCalendar(principalId, calendar)(content; pass{properties: true}for name/color changes) orpush.notifyHome(principalId)when calendars appear or vanish. - Registrations live in a
PushStore(save,remove,get,list(topic),find) shared by all instances;MemoryPushStoreis enough for one. Registrations the push service answers with 404/410 are removed. - Topics are opaque hashes. With
Calendar.globalIda shared calendar has one topic for everybody, so onenotifyCalendarreaches all members; without it, call it per member.
None of the common CalDAV clients locks, but generic WebDAV tools do. With a locks provider the server supports
LOCK / UNLOCK (WebDAV class 2, DAV: 1, 2, 3), lockdiscovery and supportedlock, and refuses changes to locked
resources with 423 unless the If header carries the lock token of the lock's holder. Locks have to be visible to
every server instance; MemoryLocks keeps them in memory for a single one:
import {MemoryLocks} from 'caldav-provider-server';
const provider = {...myProvider, locks: new MemoryLocks()};For several instances, implement LockProvider (find, findBelow, save, remove) on a shared store such as
Redis or your database. Timeouts default to an hour and are capped at a day.
Locks belong to a URL. A calendar shared between users has one URL per user; give it a globalId (the same for
everybody, e.g. your database id) and a lock covers it under all of them. Locks are then stored under
calendar:<globalId>/… instead of the path.
The tests replay request bodies of real clients against the server (test/fixtures, sources and how each body was
obtained in test/fixtures/SOURCES.md).
| Client | Fixtures from | What it uses |
|---|---|---|
| Apple Calendar (macOS, iOS) | recordings in Apple's CalendarServer (OS X 10.7–10.11) | well-known, principal, calendar home with sync-collection, CTag, calendar-query, multiget, free-busy |
| Apple Reminders | recordings in Apple's CalendarServer (iOS 5) | calendars with VTODO, calendar-query for VTODO, multiget |
| Thunderbird | Thunderbird source (comm-central) | PROPFIND Depth 1 or sync-collection for ETags, then multiget; no calendar-query |
| DAVx⁵ | dav4jvm 5.0.0 with the property lists of DAVx⁵ | sync-collection (Depth 0), calendar-query for events and to-dos, multiget with Schedule-Tag |
Notes per client:
- Apple Calendar only shows calendars with
VEVENT, Apple Reminders only those withVTODO. Shared calendars without write privileges are reported read-only. - Apple Calendar sends
PROPPATCHforcalendar-color,calendar-orderandcalendar-timezoneof every calendar on startup and whenever the user changes them,schedule-calendar-transpfor "Ignore in availability". Color and order are per user in Apple's view: if your calendars are shared, one user's change reaches everybody. New calendars and reminder lists come asMKCALENDARwith a UUID as id. - DAVx⁵ creates calendars with
MKCALENDAR(name, color, description,calendar-timezone-id, a component set if not all types are wanted) and deletes them withDELETE. Thunderbird neither creates nor changes server calendars. - Apple polls the calendar home with
sync-collection; the home sync token is computed from the calendars' tokens, so it needs no storage. - Apple Calendar moves an event to another calendar with
MOVE(Destination,Overwrite: F); implementmoveObjectto keep it the same event. Without it,MOVEanswers 403 and the app triesPUT+DELETEinstead. - Thunderbird finds the scheduling inbox and outbox through
principal-collection-setand the principal. - DAVx⁵ uses
If-Schedule-Tag-Matchwhen scheduling is enabled; withoutscheduleTagin your objects the ETag is used. - Sync tokens of other servers (e.g. after moving an account) are answered with 403
valid-sync-token, and all clients then start a full sync.
The fixtures are request bodies, not complete sessions. Newer macOS and iOS versions send the same requests with some
more properties; check a setup with the example server below, and RECORD=… to write down what a client sends.
- Changing ACLs:
DAV:acl,supported-privilege-setandacl-restrictionsare reported (the user's own privileges as one protected ACE), theACLmethod answers 403; who may do what is up to the provider - Other users' calendars without a delegation: their principal URL answers with
getPrincipal, their calendar home 403 - Locks of unmapped URLs (they would create empty resources)
- The invitee side of the WebDAV resource sharing draft (its notifications and replies); invitees use CalendarServer's notifications
example/server.ts runs the server with an in-memory provider: two users, a personal calendar each, a team calendar
that is read-only for Bob and a to-do list for both.
npm install
npm run example
# CalDAV server: http://localhost:5232/dav/ (users alice/alice and bob/bob)With RECORD=./recordings npm run example every request and response is written to ./recordings as JSON.
- System Settings → Internet Accounts → Add Account → Add Other Account → CalDAV Account
- Account Type: Manual, User Name
alice, Passwordalice, Server Addresshttp://localhost:5232/dav/ - Calendar shows "Personal" and "Team (read-only for Bob)", Reminders shows "Team to-dos".
macOS also accepts http:// for local servers; for an iPhone in the same network use the Mac's IP address instead of
localhost. With "Advanced" the server path is /dav/ and the port 5232, SSL off.
Log in as bob on a second Mac (or with a second account) to see the read-only calendar and to try invitations:
invite bob@example.com from Alice's calendar and the event appears in Bob's calendar.
New Calendar → On the Network → Username alice, Location http://localhost:5232/dav/ → Find Calendars.
Login with URL and user name → Base URL http://<ip-of-your-machine>:5232/dav/, user alice, password alice.
MIT