Back to Devexpress

DXOutlook365Sync.MergeConflictResolve Event

windowsforms-devexpress-dot-xtrascheduler-dot-microsoft365calendar-dot-dxoutlook365sync-910f69e0.md

latest7.2 KB
Original Source

DXOutlook365Sync.MergeConflictResolve Event

Allows you to resolve a merge conflict.

Namespace : DevExpress.XtraScheduler.Microsoft365Calendar

Assembly : DevExpress.XtraScheduler.v25.2.Microsoft365Calendar.dll

NuGet Package : DevExpress.Scheduler.Core.Desktop.Microsoft365Calendar

Declaration

csharp
public event EventHandler<Outlook365CalendarMergeEventArgs> MergeConflictResolve
vb
Public Event MergeConflictResolve As EventHandler(Of Outlook365CalendarMergeEventArgs)

Event Data

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

PropertyDescription
ActionTypeGets or sets a merge action.
HandledGets or sets a value that specifies whether a merge operation was handled and no default processing is required.
IsMergeConflictGets a value that indicates whether a merge conflict was detected.
OutlookEventGets a source event in a user calendar or the default calendar in Outlook365.
SchedulerAppointmentGets a source appointment.
TargetOutlookEventGets or sets the target Outlook 365 event.
TargetSchedulerAppointmentGets or sets the target appointment.

The event data class exposes the following methods:

MethodDescription
ConvertAppointmentToEvent(Appointment)Converts the specified appointment to an Outlook 365 event.
ConvertEventToAppointment(Event, String, Boolean)Converts the specified Outlook 365 event to an appointment.

Remarks

The DXOutlook365Sync component raises the MergeConflictResolve event when a merge conflict occurs and allows you to resolve the conflict.

Use the e.ActionType property to specify a merge action.

The e.OutlookEvent and e.SchedulerAppointment properties specify the Outlook 365 event and Scheduler appointment being compared.

csharp
using DevExpress.XtraScheduler.Microsoft365Calendar;

dxOutlook365Sync1.MergeConflictResolve += DxOutlook365Sync1_MergeConflictResolve;
private void DxOutlook365Sync1_MergeConflictResolve(object sender, Outlook365CalendarMergeEventArgs e) {
    DateTime appointmentLastModified = e.SchedulerAppointment.GetSchedulerChangedUTC().Value;
    DateTime eventLastModified = e.OutlookEvent.LastModifiedDateTime.Value.UtcDateTime;
    e.ActionType = appointmentLastModified > eventLastModified ? MergeActionType.InsertOrUpdateEvent : MergeActionType.InsertOrUpdateAppointment;
}
vb
Imports DevExpress.XtraScheduler.Microsoft365Calendar

Private dxOutlook365Sync1.MergeConflictResolve += AddressOf DxOutlook365Sync1_MergeConflictResolve
Private Sub DxOutlook365Sync1_MergeConflictResolve(ByVal sender As Object, ByVal e As Outlook365CalendarMergeEventArgs)
    Dim appointmentLastModified As Date = e.SchedulerAppointment.GetSchedulerChangedUTC().Value
    Dim eventLastModified As Date = e.OutlookEvent.LastModifiedDateTime.Value.UtcDateTime
    e.ActionType = If(appointmentLastModified > eventLastModified, MergeActionType.InsertOrUpdateEvent, MergeActionType.InsertOrUpdateAppointment)
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the MergeConflictResolve event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-scheduler-synchronize-appointments-with-outlook-365/CS/DXOutlook365Sync/Form1.cs#L24

csharp
dxOutlook365Sync1.MergeSingleItem += DxOutlook365Sync1_MergeSingleItem;
    dxOutlook365Sync1.MergeConflictResolve += DxOutlook365Sync1_MergeConflictResolve;
}

winforms-scheduler-synchronize-appointments-with-outlook-365/VB/DXOutlook365Sync/Form1.vb#L25

vb
AddHandler dxOutlook365Sync1.MergeSingleItem, AddressOf DxOutlook365Sync1_MergeSingleItem
    AddHandler dxOutlook365Sync1.MergeConflictResolve, AddressOf DxOutlook365Sync1_MergeConflictResolve
End Sub

See Also

Synchronization with Microsoft 365 Calendars

DXOutlook365Sync Class

DXOutlook365Sync Members

DevExpress.XtraScheduler.Microsoft365Calendar Namespace