Restrictions on Date queries with WebDAV SQL for Exchange

Turns out that you can’t query Exchange appointments for arbitrary date ranges.  According to Patrick at Microsoft (appropriate since it’s St. Patrick’s day), you are limited to querying to a 2 year range if you are searching for on both start and end date. For example, the below query is not legal:

SELECT
  "DAV:contentclass", "urn:schemas:calendar:dtstart",
  "urn:schemas:calendar:dtend",
  "http://schemas.microsoft.com/mapi/subject"
FROM
  "https://mail.example.com/exchange/somemailbox/Calendar"
WHERE
  "DAV:contentclass" = 'urn:content-classes:appointment'
  AND
  "urn:schemas:calendar:dtend" >=  CAST(\"2008-03-18T20:03:21.312Z\" as 'dateTime')
  AND
  "urn:schemas:calendar:dtend" <=  CAST(\"2028-03-18T20:03:21.312Z\" as 'dateTime') "

This doesn't mean that queries can't return more than two years worth of results, you just can used date ranges of more than two years. The resulting error is a (422) Unprocessable Entity. Other causes for this error are attempting to search on unsearchable fields.

  1. Also see my post about additional restrictions on WebDAV/Exchange.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks and Pingbacks: