|
 |
asp_cdo thread: How to programmatically "remove from calendar"?
Message #1 by "Morten Grøtan" <morten.grotan@e...> on Tue, 9 Apr 2002 16:29:20
|
|
The scenario:
User A has sent a meeting request to user B. User B has accepted this and
the meeting is stored in user B's private calendar.
Then user A sends a cancellation and user B receives a special message
stating this fact. In Outlook you then get a button which reads "Remove
from calendar" in order to remove the meeting from user B's private
calendar.
But how to simulate this last "remove from calendar" trick
programmatically (in for instance VBScript) when logged on and
authenticated as user B?
I know how to retrieve the actual Appointment object from the message, by
iterating through the CalendarParts collection and then running the
GetUpdatedItem method of the CalendarPart.
I also know how to delete a specific calendar entry (when I know its exact
UID) by doing lots of mumbo jumbo involving the following code:
*** START CODE ***
set rcAppointment = Server.CreateObject("ADODB.Record")
set rstAppointment = Server.CreateObject("ADODB.Recordset")
set rcDeleteApp = Server.CreateObject("ADODB.Record")
rcAppointment.Open strCalendarURL
set rstAppointment.ActiveConnection = rcAppointment.ActiveConnection
rstAppointment.Source = _
"SELECT * " & _
" FROM scope('shallow traversal of """ & strCalendarURL & """') "
& _
" WHERE (""urn:schemas:calendar:uid"" = '" & strUid & "')"
rstAppointment.Open
if not rstAppointment.EOF then
set rcDeleteApp.ActiveConnection = rstAppointment.ActiveConnection
strCancelItemURL = rstAppointment.Fields("DAV:href").Value
rcDeleteApp.Open strCancelItemURL, , 3 'adModeReadWrite
rcDeleteApp.DeleteRecord
end if
*** END CODE ***
The problem is that I can't use the second method when all I have
available is the Appointment object. As far as I can see, there is no UID
to retrieve anywhere from it.
I guess I could always instantiate a Cancel object (with the
CleanupCalendar flag set) from the Appointment object and send it off to
the organizer, but that's fairly contradictory to what normally happens in
Outlook.
Anybody feel up to some serious problemsolving?
Message #2 by "Morten Grøtan" <morten.grotan@e...> on Wed, 10 Apr 2002 08:41:20
|
|
Ehem, the solution is actually embarassingly easy ;-)
Once I've got the Appointment object, it's all just a matter of retrieving
the correct value from the everpresent but oh so strange Fields
collection - something I've even done earlier (shame on me....).
The code evaluates to nothing less than:
strMessageUid = objAppointment.Fields("urn:schemas:calendar:uid")
I then use this Uid in my code for deleting the correct calendar entry.
Case closed.
|
|
 |