Platform SDK: Exchange 2000 Server

Declining a Previously Accepted Meeting

[This is preliminary documentation and subject to change.]

Attendees, who want to remove themselves from a meeting, can open the meeting in their calendar folder, and send a decline response message to the organizer. The meeting remains in the attendee's calendar with a status of declined, unless the attendees delete the meeting from their calendar folders.

If you want to remove the meeting from your calendar without notifying the organizer, delete the meeting as shown in Canceling an Appointment.

Note   It is a good idea to verify that you are not the organizer of a meeting before trying to decline a meeting.

The basic process for declining a previously accepted meeting is as follows:

  1. Open the calendar folder using an ADODB record set. Use the adOpenStatic and adLockOptimistic options on the Open method to enable deleting members of the record set.
  2. Locate the meeting you want to decline and open it using an Appointment object. Verify you are not the organizer. Be sure to open the meeting in read/write mode using adModeReadWrite option.
  3. Create a Calendar Message object using the IAppointment.Decline method.
  4. Add any desired text to the Calendar Message object.
  5. Send the Calendar Message object using the IMessage.Send method.
  6. Delete the declined meeting from the calendar folder (optional).

The following code example gets all of the meetings in the calendar of a specific user with the subject "Documentation Review Meeting." It verifies that the user is not the organizer, sends the decline message, and then deletes the meeting from the calendar folder.

[Visual Basic]
Dim CalendarURL As String
Dim ItemURL     As String
Dim Rs          As New ADODB.Recordset
Dim Rec         As New ADODB.Record
Dim iAppt       As New Appointment
Dim Config      As New Configuration
Dim iAtnds      As CDO.IAttendees
Dim iCalMsg     As CDO.CalendarMessage
Dim Address     As String
Dim Index       As Integer

CalendarURL = "file://./backofficestorage/" & DomainName & "/MBX/" & UserName & "/calendar/"

'Set the configuration fields
Config.Fields(cdoSendEmailAddress) = UserName & "@" & DomainName
Config.Fields.Update
iAppt.Configuration = Config

'Set the address of the user for comparing with the attendee value
Address = "MAILTO:" & UserName & "@" & DomainName

'Open a record set for the items in the calendar folder
Rec.Open CalendarURL
Set Rs.ActiveConnection = Rec.ActiveConnection
Rs.Source = "SELECT ""DAV:href"", ""urn:schemas:httpmail:subject"" " & _
  "FROM scope('shallow traversal of """ & CalendarURL & """')" & _
  "WHERE (""urn:schemas:httpmail:subject"" = 'Documentation Review Meeting')"
Rs.Open , , adOpenStatic, adLockOptimistic

'Enumerate the record set
Rs.MoveFirst
Do Until Rs.EOF
  'Open each meeting
  ItemURL = Rs.Fields(CdoDAV.cdoHref).Value
  iAppt.DataSource.Open ItemURL, , adModeReadWrite
  Set iAtnds = iAppt.Attendees
  'Find this attendee and check IsOrganizer
  For Index = 1 To iAtnds.Count
    If Not (iAtnds.Item(Index).IsOrganizer) And iAtnds.Item(Index).Address = Address Then
      'Create a response message and send it to the organizer
      Set iCalMsg = iAppt.Decline
      iCalMsg.Message.TextBody = "Sorry, I cannot attend this meeting."
      iCalMsg.Message.Send
      'Delete the appointment from the calendar folder (optional)
      Rs.Delete
      Exit For 'Stop checking attendees
    End If 'User is not the organizer
  Next Index

Rs.MoveNext
Loop