I need to pull all non-private items from a user's calendar in Exchange 2003. I've gotten the following to work, which pulls all of their items (including the Private field):
<?xml version="1.0"?>
<g:searchrequest xmlns:g="DAV:" xmlns:mapi="http://schemas.microsoft.com/mapi/">
<g:sql>
SELECT "http://schemas.microsoft.com/mapi/Private", "urn:schemas:calendar:uid", "urn:schemas:calendar:location", "urn:schemas:httpmail:subject", "urn:schemas:calendar:dtstart", "urn:schemas:calendar:dtend", "urn:schemas:calendar:busystatus", "urn:schemas:calendar:meetingstatus", "urn:schemas:calendar:instancetype"
FROM Scope('SHALLOW TRAVERSAL OF "%s"')
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' AND "mapiPrivate" = 0
ORDER BY "urn:schemas:calendar:dtstart" ASC
</g:sql>
</g:searchrequest>
However, when I try to add the Private field to the WHERE
I get a BAD REQUEST
error in response. The following code is how I added the Private field to the WHERE
clause.
<?xml version="1.0"?>
<g:searchrequest xmlns:g="DAV:" xmlns:mapi="http://schemas.microsoft.com/mapi/">
<g:sql>
SELECT "http://schemas.microsoft.com/mapi/Private", "urn:schemas:calendar:uid", "urn:schemas:calendar:location", "urn:schemas:httpmail:subject", "urn:schemas:calendar:dtstart", "urn:schemas:calendar:dtend", "urn:schemas:calendar:busystatus", "urn:schemas:calendar:meetingstatus", "urn:schemas:calendar:instancetype"
FROM Scope('SHALLOW TRAVERSAL OF "%s"')
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' AND "mapiPrivate" = 0 AND "http://schemas.microsoft.com/mapi/Private" = 0
ORDER BY "urn:schemas:calendar:dtstart" ASC
</g:sql>
</g:searchrequest>
What am I doing wrong? Is this not possible?
You need to request the PR_SENSITIVITY property (DASL name http://schemas.microsoft.com/mapi/proptag/0x00360003). For the private apppoitments its value will be SENSITIVITY_PRIVATE (=2)