Friday, October 08, 2004

Getting Meeting Attendee status and roles through WebDAV

When you send out meeting or appointment invites to people and they are accepted or denied by users the status of there acceptance (and their role in the Meeting) is stored in the recipients collection of the appointment object. In CDOEX you have a few interfaces that allow you to interrogate and retrieve this information via the IAppointment and IAttendee interfaces. EG

set apptobj = createobject("CDO.Appointment")
apptobj.datasource.open "file://./backofficestorage/domain.com.au/MBX/mailbox/calendar/appointment.EML"
for each attend in apptobj.Attendees
wscript.echo attend.address
wscript.echo attend.role
wscript.echo attend.status
next

In WebDAV access to the recipients collection of a message is very limited and usually all you can retrieve is the email address and or displayname of each attendee. A while ago I blogged this about a method of accessing a meeting resource's email address by using the vCalendar body part of an appointment. The attendee status and attendee role are also stored in this vCalendar body part so you can extend this method to also parse out the attendee Role and attendee Status from this body part. Here's what it looks like in script. If you want to download a copy I've put it up here

set Req = createobject("Microsoft.XMLHTTP")
Req.open "GET", "http://server/exchange/mailbox/Calendar/appoinment.EML", false
Req.setRequestHeader "Translate","f"
Req.send
attendeearry = split(req.responsetext,"ATTENDEE;",-1,1)
for i = 1 to ubound(attendeearry)
string1 = vbcrlf & " "
stparse = replace(attendeearry(i),string1,"")
attaddress = mid(stparse,(instr(stparse,"MAILTO:")+7),instr(stparse,chr(13)))
attaddress = mid(attaddress,1,instr(attaddress,vbcrlf))
attrole = mid(stparse,(instr(stparse,"ROLE=")+5),instr((instr(stparse,"ROLE=")+5),stparse,";")-(instr(stparse,"ROLE=")+5))
attstatus = mid(stparse,(instr(stparse,"PARTSTAT=")+9),instr((instr(stparse,"PARTSTAT=")+9),stparse,";")-(instr(stparse,"PARTSTAT=")+9))
wscript.echo attaddress
wscript.echo attrole
wscript.echo attstatus
next

1 comment:

Gorazd Svajger said...

Excellent stuff, prevented me from polluting the newsgroups with a new thread.