InfiniTec - Henning Krauses Blog

Don't adjust your mind - it's reality that is malfunctioning

A search on a calendar folder can not span more than 732 days

More Information

A SEARCH on an Exchange calendar folder with a constraint of a begin and an end date is called an expansion query. This means, that all recurring appointments are expanded, and each instance is returned in the query. (See Searching Calendar Folders with WebDAV on MSDN for more information. The article specifically targets the WebDAV  protocol, but the issue explained here applies to the ExOleDB provider as well).

An example of such a query is displayed below.

If you run this query and use values for the start and end properties where the difference between start and end is greater than 732 days, you get the following error:

Error while processing WHERE clause in the SQL statement.

Example

An example of such an expansion query might look like this:

    1 SEARCH /exchange/~username/calendar/ HTTP/1.1

    2 Host: www.example.com

    3 Content-Type: text/xml

    4 

    5 <?xmlversion="1.0"?>

    6 <g:searchrequestxmlns:g="DAV:">

    7   <g:sql>

    8     Select "urn:schemas:calendar:location", "urn:schemas:httpmail:subject",

    9     "urn:schemas:calendar:dtstart", "urn:schemas:calendar:dtend",

   10     "urn:schemas:calendar:busystatus", "urn:schemas:calendar:instancetype"

   11     FROM Scope('SHALLOW TRAVERSAL OF ""') WHERE

   12     "DAV:contentclass" = 'urn:content-classes:appointment'

   13     AND "urn:schemas:calendar:dtstart" &gt; CAST("2005-01-01T00:00:00Z" AS 'dateTime.tz')

   14     AND "urn:schemas:calendar:dtend" &lt; CAST("2006-01-01T00:00:00Z" AS 'dateTime.tz')

   15     ORDER BY "urn:schemas:calendar:dtstart" ASC

   16   </g:sql>

   17 </g:searchrequest>

Workaround

To work around this problem, do your search in multiple steps, with a time span of two years or less.

Status

This is a known limitation in the Exchange Server: Expansion queries are limited to a time span of two leap years.

Posted by Henning Krause on Thursday, April 13, 2006 12:00 AM, last modified on Thursday, April 13, 2006 12:00 PM
Permalink | Post RSSRSS comment feed

Comments (1) -

On 7/15/2009 5:50:26 PM Ryan Morlok United States wrote:

Ryan Morlok

Independent of the ~2 year date range restriction on query length, if you query too far in the future, infinitely recurring appointments will stop being returned.  After discussion with Microsoft (it wasn't officially documented when I was searching), I've documented my findings here:

softwareblog.morlok.net/.../

 +Pingbacks and trackbacks (1)