Getting Outlook calendar items based on subject

Posted by EKS on Stack Overflow See other posts from Stack Overflow or by EKS
Published on 2010-03-25T14:36:40Z Indexed on 2010/03/25 14:43 UTC
Read the original article Hit count: 263

Filed under:
|
|

I'm trying to get a list of calendar objects from exchange and sorting them based on subject. The part of of getting the objects just based on date and sorting out via subject is in "code" is now working, but i want to do a sort on subject in the "sql" first, but im unable to make it work ( Currently getting error from exchange saying the query is wrong.

The line I added is:

                     + "AND lcase(\"urn:schemas:calendar:subject\") = 'onsite%' "

What I want is the ability to catch all appointments that start with onsite, both in upper and lower case.

strQuery = "<?xml version=\"1.0\"?>"
                         + "<g:searchrequest xmlns:g=\"DAV:\">"
                         + "<g:sql>SELECT \"urn:schemas:calendar:location\", \"urn:schemas:httpmail:subject\", "
                         + "\"urn:schemas:calendar:dtstart\", \"urn:schemas:calendar:dtend\", "
                         + "\"urn:schemas:calendar:busystatus\", \"urn:schemas:calendar:instancetype\" "
                         + "FROM Scope('SHALLOW TRAVERSAL OF \"" + strCalendarURI + "\"') "
                         + "WHERE NOT \"urn:schemas:calendar:instancetype\" = 1 "
                         + "AND \"DAV:contentclass\" = 'urn:content-classes:appointment' "
                         + "AND \"urn:schemas:calendar:dtstart\" > '2003/06/01 00:00:00' " //'" + DateString + "'"
                         + "AND lcase(\"urn:schemas:calendar:subject\") = 'onsite' "
                         + "ORDER BY \"urn:schemas:calendar:dtstart\" ASC"
                         + "</g:sql></g:searchrequest>";

© Stack Overflow or respective owner

Related posts about exchange

Related posts about c#