Re: I want to read tasks folder using webdav: Suggestions?

From: juanito (juan_at_cubacel.com)
Date: 03/24/04


Date: Wed, 24 Mar 2004 15:25:17 -0500

Well, as someone asked I'm posting the "solution" in fact this a previous
post to the exchange application list. At the end can be found the webdav
query I'm using, which is somewhat more complete. Hope this helpJuanitoThere
have been several posts about accessing data in Exchange store
objects such as tasks that are internally represented with MAPI. Most
of these focus on using ADO/ExOLEDB, which presumes the client has
this provider or the code will execute on an Exchange server. In our
case, we wanted to access the Exchange store from a Web server to
display task properties contained in a particular public folder.
Since the Web server did not have the ExOLEDB provider, it was
necessary to send WebDAV requests to the Exchange server and process
the resulting XML reply on the Web server. We used the XMLHTTP object
to send WebDAV requests and obtain the XML responses.

We encountered several obstacles in implementing this solution, listed
below with our resolution to help anyone who's attempting a similar
project. The good news is that the solutions are straightforward and
the resulting performance, in our case, is very good.

Problem 1:
The namespace for MAPI properties of task items and other Exchange
store objects are undocumented.
Solution:
The Exchange SDK help says that the notation
http://schemas.microsoft.com/mapi/id/{[propset GUID]}/[0xHEXVALUE] is
used to access these properties. Several postings to the
microsoft.public.exchange2000 groups have partial listings of the
constants, but CDOLive has the most complete reference about such
undocumented MAPI properties at http://www.cdolive.com/cdo10.htm.
Please note that the hex values for the property set GUIDs do not work
due to a known issue. MSKB article 195656 discusses this bug and how
to convert hex values, such as the ones listed on CDOLive, into values
that are MS MAPI friendly. You should probably save yourself some
work and just search this group for these property set GUID values
since other people have already done this work.

Problem 2:
The status of the response is in the 400 range indicating a bad
request.
Solution:
The format of the hex value is very important. We had success using
values like the following:
"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x8101",
"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x8102",
"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x8103.

Problem 3:
The status of the response is 207, but responseXML property of the
XMLHTTP object is null.
Solution:
There is a response! Write the responseText property to a file to see
for yourself. The problem, therefore, lies with the format of the XML
returned in the response. Since the MAPI properties are referenced by
hex values, the XML parser gets confused and errors out parsing the
response. Others have mentioned this problem in other postings to
exchange2000 groups. If you are using WebDAV verbs such as PROPFIND
or PROPPATCH, you will have to obtain the response as text from the
responseText property and either reformat it or parse it as is using
another XML parser. If you are using the SEARCH verb, there is a much
simpler solution -- use aliases for the field names referenced by hex
values. This solution produces a valid DOMDocument object in the
responseXml property, and it makes your query and client code much
more readable. Here's our WebDAV request as an example:

<d:searchrequest xmlns:d="DAV:">
 <d:sql>
  SELECT
  "urn:schemas:httpmail:subject",
  "urn:schemas:httpmail:textdescription",
  "DAV:creationdate",

"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x8101"
AS Status,

"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x8102"
AS PercentComplete,

"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x8104"
AS StartDate,

"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x8105"
AS DueDate,

"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x810f"
AS DateCompleted,

"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x811c"
AS Complete,

"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}
/0x811f"
AS Owner
  FROM "http://[server]/[folder path]"
  WHERE "DAV:contentclass" = 'urn:content-classes:task'
  AND "urn:schemas-microsoft-com:office:office#Keywords" = '[your
keyword here]'
  ORDER BY "DAV:creationdate" DESC
 </d:sql>
</d:searchrequest>

------------------
Much thanks to other users of this group for posting their
recommendations and successes with MAPI and WebDAV. Hopefully the
suggestions/strategy here will prove equally useful to others
struggling through this.strQuery = "<?xml version=\"1.0\"?>" +

                    "<d:searchrequest xmlns:d = \"DAV:\" >" +

                    "<d:sql>" +

                            "SELECT \"DAV:displayname\", " +

                                            "\"DAV:creationdate\"," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x8101\" AS Status," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x8102\" AS PercentComplete," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x8104\" AS StartDate," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x8105\" AS DueDate," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x810f\" AS DateCompleted," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x811c\" AS Complete," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x8113\" AS State," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x8110\" AS ActualEffort," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x8111\" AS EstimatedEffort," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x8518\" AS Mode," +

"\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-00000000004
6}/0x811f\" AS Owner, " +

"\"urn:schemas:httpmail:textdescription\"," +

"\"urn:schemas:httpmail:subject\" " +

                            "FROM \"" + strRootURI + "\" " +

                            "WHERE \"DAV:ishidden\" = false " +

                                     "AND \"DAV:isfolder\" = false" +

                    "</d:sql>" +

                    "</d:searchrequest>";

"juanito" <juan@cubacel.com> wrote in message
news:uuLj7YFEEHA.3672@TK2MSFTNGP09.phx.gbl...
> Hi all,
> I want to read the tasks folder for exchange users, in order to make some
> statistics, but I can hardly find an example to do this. I tried with
WebDAV
> but only returns standart properties, and what I want is to get the start
> date, due date, total work, etc.., including if the task have been
assigned
> to some body. Any thoughts?
> TIA
>
> Juanito
>
>
>



Relevant Pages

  • RE: Exchange 2007 webdav HTTP 301 response
    ... Authentication and Form Based Authentication. ... We have an application which leverages the webdav features of Exchange ... Exchange 07 sends back a 301 rather than the expected webdav response. ...
    (microsoft.public.exchange.development)
  • Re: Retrieving exchange task thru webdav with Where clause
    ... If you need WebDAV API for Exchange server, ... Now the obvious issue to this query is that it will ... that we'd have to ultimately parse the response into a valid DOM means ...
    (microsoft.public.exchange2000.development)
  • Re: Respond to meeting request using WebDAV
    ... You may want to use CDO for Exchange which can do this. ... >> How do I respond to a meeting request using WebDAV? ... My best suggestion is to simulate an OWA button press, ... > HTML source for an OWA page as a response. ...
    (microsoft.public.exchange.development)
  • Re: How I "cured" myself of FM
    ... same time characterize my response as beating a dead horse ... has at least 2 different meanings. ... being a lawyer - so be it...all this exchange has shown is that you ... Good Shepherd Christian Fellowship ...
    (alt.med.fibromyalgia)
  • Re: WebDAV vs. MAPI performance
    ... I did some additional load testing on a 2 proc Exchange server. ... harvest regardless of the number of webdav connections we employ. ... MAPI is not supported by Microsoft. ...
    (microsoft.public.exchange.applications)

Loading