Sdílet prostřednictvím


Updating Appointments and Meetings

Topic Last Modified: 2006-06-12

You can update the properties and fields of an appointment or meeting that is saved in your calendar folder. For appointments, you overwrite the original appointment in the Exchange store with the updated appointment. For meetings, in addition to saving the changes to the Exchange store, you must send the updates to attendees. If you are not the meeting organizer and you update a meeting in your calendar folder, any updates you accept from the meeting organizer overwrite your updates.

To update an appointment or a meeting

  1. Open an appointment or meeting in the Calendar folder as shown in Getting Appointments and Meetings from Folders in Exchange. Be sure to open the appointment in read/write mode by using adModeReadWrite.
  2. Change the properties and fields of the appointment or meeting.
  3. Save the appointment or meeting to the calendar folder using the IAppointment.Datasource.Save method.

The code in the following example checks all of the appointments and meetings in the calendar of user12 on the Microsoft® Exchange 2000 server in the exchange.microsoft.com domain. It changes any appointment or meeting scheduled in the "Flamingo Room" to the "Mount Rainier Room" and saves the appointment.

Example

Visual Basic

Note

The following example uses a file URL with the Exchange OLE DB (ExOLEDB) provider. The ExOLEDB provider also supports The HTTP: URL Scheme. Using The HTTP: URL Scheme allows both client and server applications to use a single URL scheme.

Dim CalendarURL As     String
Dim ItemURL     As     String
Dim Rs          As New ADODB.Recordset
Dim Rec         As New ADODB.Record
Dim Conn        As New ADODB.Connection
Dim iAppt       As New Appointment
Dim Target      As     String
Dim NewValue    As     String
Dim Location    As     String

Target = "Flamingo Room"
NewValue = "Mount Rainier Room"

  'Using the Exchange OLE DB provider
  CalendarURL = "file://./backofficestorage/user12.fourthcoffee.com/MBX/user12/calendar/"

'Open a recordset for the items in the calendar folder
Rec.Open CalendarURL
Set Rs.ActiveConnection = Rec.ActiveConnection
Rs.Source = "SELECT ""DAV:href"", ""urn:schemas:calendar:location"" from scope('shallow traversal of """ & CalendarURL & """')"
Rs.Open

'Enumerate the recordset, checking each item's location
Rs.MoveFirst
Do Until Rs.EOF
  'get the location of each item
  Location = Rs.Fields(CdoCalendar.cdoLocation).Value
  'test for desired location
  If (Location = Target) Then
    'open appointment in read/write mode and update the location property
    ItemURL = Rs.Fields(CdoDAV.cdoHref).Value
    iAppt.DataSource.Open ItemURL, , adModeReadWrite
    iAppt.Location = NewValue
    iAppt.DataSource.Save
  End If
  Rs.MoveNext
Loop