Skip to content

calendarQuery

calendarQuery performs a search for all calendar object resources that match a specified filter.

The response of this report will contain all the WebDAV properties and calendar object resource data specified in the request.

In the case of the calendarData element, one can explicitly specify the calendar components and properties that should be returned in the calendar object resource data that matches the filter.

// fetch all objects of the calendar
const results = await calendarQuery({
url: 'https://caldav.icloud.com/1234567/calendars/personal/',
props: {
[`${DAVNamespaceShort.DAV}:getetag`]: {},
},
filters: [
{
'comp-filter': {
_attributes: {
name: 'VCALENDAR',
},
},
},
],
depth: '1',
headers: {
authorization: 'Basic x0C9uFWd9Vz8OwS0DEAtkAlj',
},
});
  • url required, request target url
  • props required, CALDAV prop element in ElementCompact form
  • filters CALDAV filter element in ElementCompact form
  • depth DAVDepth
  • timezone iCalendar VTIMEZONE string used to interpret floating times
  • headers request headers
  • headersToExclude array of keys of the headers you want to exclude
  • fetchOptions options to pass to underlying fetch function
  • fetch custom fetch implementation

array of DAVResponse

send a calendar-query REPORT request, after server applies the filters and parse the response xml to an array of DAVResponse.