AppointmentSynchronizer.AppointmentSynchronizing Event

Allows you to cancel the synchronization process for an appointment.

Namespace: DevExpress.XtraScheduler.Exchange

Assembly: DevExpress.XtraScheduler.v20.1.Core.dll


public event AppointmentSynchronizingEventHandler AppointmentSynchronizing
Public Event AppointmentSynchronizing As AppointmentSynchronizingEventHandler

Event Data

The AppointmentSynchronizing event's data class is AppointmentSynchronizingEventArgs. The following properties provide information specific to this event:

Property Description
Appointment Gets the appointment for which the event was raised. Inherited from AppointmentEventArgs.
Cancel Gets or sets whether the operation performed on the processed event should be cancelled. Inherited from AppointmentCancelEventArgs.
Operation Specifies what type of synchronization operation should be performed.


The AppointmentSynchronizing event is raised before synchronization begins and allows you to cancel the process. The event parameter's AppointmentEventArgs.Appointment property identifies the processed appointment, the AppointmentSynchronizingEventArgs.Operation property specifies the operation to perform. To skip it, set the AppointmentCancelEventArgs.Cancel property to true.

Handling the event enables you to make a decision based on the current item properties. You can leave the item intact, modify it or perform other actions that suit your synchronization model.

By analyzing the AppointmentSynchronizingEventArgs.Operation value and AppointmentEventArgs.Appointment properties, you can implement virtually any appointment conflict resolution scenario. If the target calendar application contains both previous and new appointments, and you want to leave the existing appointments intact, you can set Cancel to true to stop the operation when AppointmentSynchronizingEventArgs.Operation is equal to SynchronizeOperation.Replace.

Other scenarios may require modifying the operation type within the AppointmentSynchronizing event handler. Instead of SynchronizeOperation.Replace you may choose to SynchronizeOperation.Delete the calendar item. This can be easily accomplished by changing the AppointmentSynchronizingEventArgs.Operation value.



WARNING: If you call the SchedulerStorageBase.SynchronizeOutlookWithStorage method, all data in your MS Outlook will be lost. We suggest that you backup all your data prior to running this example.

The following example demonstrates how to synchronize appointments data in the SchedulerStorage with the data already stored in the MS Outlook database, and vice versa in one step.

To perform an easy synchronization, use the SchedulerStorageBase.SynchronizeStorageWithOutlook and SchedulerStorageBase.SynchronizeOutlookWithStorage methods.

Before synchronizing the SchedulerStorage with MS Outlook, create an additional field in your database. This field should be of the string type with a length of at least 50 characters, and intended to store the Outlook Entry Id for each appointment that is to be synchronized. Assuming the field is called "OutlookEntryId", you can then use the following code to synchronize the Scheduler Storage with MS Outlook and vice versa.

private void button1_Click(object sender, System.EventArgs e) {

private void button2_Click(object sender, System.EventArgs e) {

For this example to work correctly, the Scheduler's data source should provide a field to store the Outlook Entry ID. The filed should be mapped to a custom appointment field, as illustrated below.

schedulerStorage.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("OutlookId", "OutlookEntryId"));

If your purpose is to unite all data from the SchedulerStorage and MS Outlook, use the SchedulerStorageBase.ExportToOutlook and SchedulerStorageBase.ImportFromOutlook methods instead. To set custom rules when synchronizing appointments, use the AppointmentExportSynchronizer and the AppointmentImportSynchronizer classes.

See Also