WebDav, adding an appointment

To add an appointment you need to send a simple xml message to the MS Exchange Server uisng WebDav:

<?xml version=””1.0″”?><g:propertyupdate xmlns:g=””DAV:=”””” xmlns:e=””http:=””//schemas.microsoft.com/exchange/”” xmlns:mapi=””http://schemas.microsoft.com/mapi/”” xmlns:mapit=””http://schemas.microsoft.com/mapi/proptag/”” xmlns:x=””xml:”” xmlns:cal=””urn:schemas:calendar:”” xmlns:dt=””urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/”” xmlns:header=””urn:schemas:mailheader:”” xmlns:mail=””urn:schemas:httpmail:””><g:set>
<g:prop>
<g:contentclass>urn:content-classes:appointment</g:contentclass>
<e:outlookmessageclass>IPM.Appointment</e:outlookmessageclass>
<mail:subject>{0}</mail:subject>
<mail:htmldescription>{1}</mail:htmldescription>
<cal:location>{2}</cal:location>
<cal:dtstart dt:dt=””dateTime.tz=””””>{3}</cal:dtstart>
<cal:dtend dt:dt=””dateTime.tz=””””>{4}</cal:dtend>
<cal:instancetype dt:dt=””int=””””>{5}</cal:instancetype>
<cal:busystatus>{6}</cal:busystatus>
<cal:meetingstatus>{7}</cal:meetingstatus>
<cal:alldayevent dt:dt=””boolean=””””>{8}</cal:alldayevent>
<cal:responserequested dt:dt=””boolean=””””>{9}</cal:responserequested>
<cal:reminderoffset dt:dt=””int=””””>{10}</cal:reminderoffset>
<header:to>{11}</header:to>
<mapi:finvited dt:dt=””boolean=””””>{12}</mapi:finvited>
</g:prop>
</g:set></g:propertyupdate>

You can use this message in String.Format(…) method and fill with your own variables.

Notes:
1. To add an appointment you must use PROPPATCH request method.
2. To update the appointment you can use same xml message, but exclude all fields which will stay unmodified, so you need to pass only items you are updating, for example if you need to update subject, all other fields simply excluded:

<?xml version=””1.0″”?><g:propertyupdate xmlns:g=””DAV:=”””” xmlns:e=””http:=””//schemas.microsoft.com/exchange/”” xmlns:mapi=””http://schemas.microsoft.com/mapi/”” xmlns:mapit=””http://schemas.microsoft.com/mapi/proptag/”” xmlns:x=””xml:”” xmlns:cal=””urn:schemas:calendar:”” xmlns:dt=””urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/”” xmlns:header=””urn:schemas:mailheader:”” xmlns:mail=””urn:schemas:httpmail:””><g:set>
<g:prop>
<g:contentclass>urn:content-classes:appointment</g:contentclass>
<e:outlookmessageclass>IPM.Appointment</e:outlookmessageclass>
<mail:subject>{0}</mail:subject>
</g:prop>
</g:set></g:propertyupdate>

3. Request should be send to the appointment URI.
4. You have to add authorization credentials to the request, so do not forget to do that.

Happy coding (:

Best regards,
Yahor