View Multiple Calendars with WebDAV

Posted on 2011-10-04
Last Modified: 2013-12-06
I am successfully displaying calendar appointments for a specific Exchange account. I do this by using WebDav and passing a request string like the following:

"<?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 \"\"') WHERE NOT \"urn:schemas:calendar:instancetype\" = 1 AND \"DAV:contentclass\" = 'urn:content-classes:appointment' AND \"urn:schemas:calendar:dtstart\" > '2011/10/04 00:00:00' AND \"urn:schemas:calendar:dtend\" &lt; '2011/10/05 00:00:00' ORDER BY \"urn:schemas:calendar:dtstart\" ASC</g:sql></g:searchrequest>"

Note that the above string has a SELECT statement with a FROM clause, similar to most database queries. The FROM clause references the calendar for the Exchange account Allen ("\"). This (among other lines of code not included here) successfully retrieves and displays Allen's appointments.

What I want to do is retrieve and display the appointments for 2 or more calendars at the same time. So my question is, how do I chain 2 or more requests in the above string?

From a standard database query standpoint, maybe a JOIN clause can be added in order to include another source (calendar). Maybe the above SELECT could have Allen's appointments (FROM "\") and then include Bob's appointments with something like JOIN "\". But JOINs genearlly imply that there is some relation between the 2 sources. But Allen and Bob's calendar data are completely independent appointments, and not related in any way.

What may be more appropriate is a UNION statement that would include the SELECTed data from Allen's calendar along with (UNION) the SELECTed data from Bob's calendar.

The bottom line is that I can't figure out how to modify the above string to request calendar data from multiple sources. Does anyone know how to make this work?

Question by:brian_appliedcpu
    LVL 31

    Accepted Solution

    Sadly, you can't do that with Exchange's WebDAV SQL.  It is only a tiny subset of ANSI SQL.  There is a list of unsupported SQL commands here:

    You'll need to get the data from both calendars separately, and then do the hard work in code.
    LVL 2

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Set OWA language and time zone in Exchange for individuals, all users or per database.
    In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
    This video discusses moving either the default database or any database to a new volume.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now