Friday, May 22, 2009

Acknowledging Appointment reminders with WebDAV

One thing that can be little tricky if your working in WebDAV is dealing with appointment reminders, especially when you have to deal with recurring appointments. If you dont use the right method its easy to break the recurrance of appointments. The best way of working something like this out is have a look at the way OWA does it and then just use the same xml. So basically what you end up with is firstly a method to acknowledge non-recurring appointment reminders by removing the reminderoffset property. And a method to acknowledge recurring appointment reminders by setting the remindernexttime property. I've put a download of this VBS script here the code looks like

set req = Createobject("microsoft.xmlhttp")

CalendarURL = "https://servername/exchange/mailbox/calendar"
AppointmentURL = CalendarURL & "/appointment.eml"

If RecurringAppointment = false Then
xmlstr = "<?xml version=""1.0""?><a:propertyupdate xmlns:a=""DAV:""><a:remove><a:prop>" _
& "<d:reminderoffset xmlns:d=""urn:schemas:calendar:"" /></a:prop></a:remove>" _
& "<a:target><a:href>" & AppointmentURL & "</a:href></a:target></a:propertyupdate>"
xmlstr = "<?xml version=""1.0""?><a:propertyupdate xmlns:a=""DAV:""><a:set><a:prop>" _
& "<d:remindernexttime xmlns:d=""urn:schemas:calendar:"">4501-01-01T00:00:00.000Z</d:remindernexttime>" _
& "</a:prop></a:set><a:target><a:href>" & AppointmentURL & "</a:href></a:target></a:propertyupdate>"
End if "BPROPPATCH", CalendarURL, False
req.setRequestHeader "Content-Type", "text/xml;"
req.setRequestHeader "Translate", "f"
req.setRequestHeader "Content-Length:", Len(xmlstr)
If (req.Status >= 200 And req.Status < 300) Then
Wscript.echo "Reminder Acknowledged"
Wscript.echo "Request Failed. Results = " & req.Status & ": " & req.statusText
End If

No comments: