Skip to main content
All docs
V23.2

DXOutlook365Sync.MergeSchedulerAndOutlookAsync(IMergeSolver) Method

Merges the Scheduler control with Outlook 365 calendars based on a custom merge rule.

Namespace: DevExpress.XtraScheduler.Microsoft365Calendar

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

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

Declaration

public Task MergeSchedulerAndOutlookAsync(
    IMergeSolver solver
)

Parameters

Name Type Description
solver DevExpress.XtraScheduler.Microsoft365Calendar.MergeSolvers.IMergeSolver

An object that implements a merge rule.

Returns

Type Description
Task

The task.

Remarks

This is an example on how to implement IMergeSolver descendants to merge Scheduler appointments and Outlook 365 events.

using DevExpress.XtraScheduler;

public class MergeSolverOutlookToScheduler : IMergeSolver {
    bool canRemoveSchedulerAppointments = false;
    public MergeSolverOutlookToScheduler(bool canRemoveSchedulerAppointments) { 
        this.canRemoveSchedulerAppointments= canRemoveSchedulerAppointments;
    }
    public void PostMergeAction(DXOutlook365Sync synchronizer) {
    }

    public void PreMergeAction(DXOutlook365Sync synchronizer) {
    }

    public void Solve(Outlook365CalendarMergeEventArgs args) {
        if(args.ActionType == MergeActionType.DoNothing) return;

        Appointment apt = args.SchedulerAppointment;
        Microsoft.Graph.Event evt = args.OutlookEvent;
        if((apt != null) && (evt != null)) {
            args.ActionType = MergeActionType.InsertOrUpdateAppointment;
            return;
        }

        if((apt == null) && (evt != null)) { 
            args.ActionType = MergeActionType.InsertOrUpdateAppointment;
            return;
        }

        if((apt != null) && (evt == null)) {
            if(this.canRemoveSchedulerAppointments)
                args.ActionType = MergeActionType.DeleteAppointment;
            else
                args.ActionType = MergeActionType.DoNothing;
            return;
        }
    }
}
See Also