How do I work with Tasks using WebDAV.

WebDAV was not designed for working with outlook specific items such as Tasks and is not supported.  To work with tasks, you will to reverse-engineer the solution and in order to construct the proper XML to be used for a PROPPATCH/PROPFIND.  Tasks are supported to be worked with using Outlook Object Model (OOM) and Exchange Web Services (EWS).

Comments (2)

  1. rehle says:

    I have been able to create a windows service for handling a 2 way sync between contacts and appointments data and our SQL server. However I have not been able to query the exchange server for Task data. How ever I can write tasks too Exchange…

    Is it possible to query MS Exchange via WEBDAV for task data?  If so can you provide an example or links? Just a note, I am querying for the differences since the last request, using the collblob.


  2. danba says:

    How are you able to write tasks?  Which API?  

    There is no support for working with tasks with WebDAV.  However they are supported to some degree with Exchange Web Services – which is in Exchange 2007.

    Even if you use something like the xml PROPPATCH request below, it may only work with some clients when creating Tasks and is prone to breaking.  Because of this, it’s not advisable to use WebDAV for tasks.  For things like task requests, you may not be able to even create anything with even basic functionality.

    WebDAV should be able to read with a PROPFIND what its able to set with a PROPPATCH. However, I don’t know the behavior of the task related properties since this is not documented, not supported my Microsoft via WebDAV.

    Tasks are only supported with Outlook Object Model (OOM) and with Exchange Web Services (EWS).  Exchange Web Services (EWS) can be called from pretty much any place.  Outlook Object Model (OOM) is only supported from a desktop application with a use to attend to it – so its not supported in a service, stored proceedure, DTS, COM+, ASP, etc.

    You should not be using WebDAV code – such as the code below:

           ‘define namespaces

           strXMLNSInfo = ""

           strXMLNSInfo = "xmlns:dav=""DAV:"" "

           strXMLNSInfo = strXMLNSInfo & "xmlns:ex="""" "

           strXMLNSInfo = strXMLNSInfo & "xmlns:mail=""urn:schemas:httpmail:"" "

           strXMLNSInfo = strXMLNSInfo & "xmlns:task=""{00062003-0000-0000-C000-000000000046}/"" "

           strXMLNSInfo = strXMLNSInfo & "xmlns:g2=""{00062008-0000-0000-C000-000000000046}/"" "

           strXMLNSInfo = strXMLNSInfo & "xmlns:dt=""urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"" "

           strXMLNSInfo = strXMLNSInfo & ">"

           ‘general Task properties

           strTask_MessageClass = "<ex:outlookmessageclass>IPM.Task</ex:outlookmessageclass>"

           ‘individual Task properties

           strTask_Subject = "<mail:subject>Some sort of task</mail:subject>"  ‘ TODO: Change Text

           strTask_PercentComplete = "<task:0x00008102 dt:dt=""float"">.25</task:0x00008102>" ‘ TODO: Change Text

           strTask_StartDate = "<task:0x00008104 dt:dt="""">2004-02-26T23:00:00.000Z</task:0x00008104>" ‘ TODO: Change Text

           strTask_DueDate = "<task:0x00008105 dt:dt="""">2004-02-27T23:00:00.000Z</task:0x00008105>"  ‘ TODO: Change Text

           strTask_Status = "<task:0x00008101 dt:dt=""int"">1</task:0x00008101>"

           strTask_Complete = "<task:0x0000811c dt:dt=""boolean"">1</task:0x0000811c>"

           ‘ build final

           strBody = "<?xml version=""1.0""?>" & _

              "<dav:propertyupdate " & strXMLNSInfo & _

                  "<dav:set>" & _

                      "<dav:prop>" & _

                          "<dav:contentclass>urn:content-classes:task</dav:contentclass>" & _

                          strTask_MessageClass & _

                          strTask_Subject & _

                          strTask_PercentComplete & _

                          strTask_StartDate & _

                          strTask_DueDate & _

                          strTask_Status & _

                          strTask_Complete & _

                      "</dav:prop>" & _

                  "</dav:set>" & _