views:

68

answers:

0

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>";

I have found the lcase() on the internet, seems to be the sql command to make strings lowercase. schemas:calendar:subject was found here