Skip to main content
All docs
V24.1

DXOutlook365Sync.ImportOutlookToSchedulerAsync(Boolean) Method

Imports events from Outlook 365 calendars with synchronization enabled to the Scheduler control.

Namespace: DevExpress.XtraScheduler.Microsoft365Calendar

Assembly: DevExpress.XtraScheduler.v24.1.Microsoft365Calendar.dll

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

Declaration

public Task ImportOutlookToSchedulerAsync(
    bool canRemoveSchedulerAppointments
)

Parameters

Name Type Description
canRemoveSchedulerAppointments Boolean

true to clear appointments before import; otherwise, false.

Returns

Type Description
Task

The asynchronous operation.

Remarks

Important

You must initialize the DXOutlook365Sync component before using the ImportOutlookToSchedulerAsync method. Otherwise, the DXOutlook365Sync component throws an exception.

The ImportOutlookToSchedulerAsync method imports events from Outlook 365 calendars with synchronization enabled (EnableSynchronization).

Read the following topic for detailed information and examples: Synchronization with Microsoft 365 Calendars.

Example: Import Outlook 365 Events

This example demonstrates how to import events from all Outlook 365 calendars to the WinForms Scheduler control.

using DevExpress.XtraScheduler.Microsoft365Calendar;

DXOutlook365Sync dxOutlook365Sync1;
public Form1() {
    InitializeComponent();
    dxOutlook365Sync1 = new DXOutlook365Sync(schedulerDataStorage1);
    dxOutlook365Sync1.InitComplete += DxOutlook365Sync1_InitComplete;
}
private async Task<bool> InitOutlook365Sync(DXOutlook365Sync outlook365sync) {
    // Initializes the 'dxOutlook365Sync1' component.
    string tenantId = "..."; // Enter your tenant (directory) ID.
    string clientId = "..."; // Enter your client (application) ID.
    InitStatus status = await outlook365sync.InitAsync(tenantId, clientId);
    // Returns false and displays a message box if the initialization of 'dxOutlook365Sync1' failed.
    if(status == InitStatus.Error) {
        XtraMessageBox.Show("Initialization of DXOutlook365Sync failed.", "Error", MessageBoxButtons.OK);
        return false;
    }
    return true;
}
private async void importEventsButton_Click(object sender, EventArgs e) {
    // Checks whether the initialization of 'dxOutlook365Sync1' failed.
    if(!await InitOutlook365Sync(dxOutlook365Sync1)) return;
    // Displays the wait form.
    splashScreenManager1.ShowWaitForm();
    // Imports Outlook 365 events to the Scheduler control.
    await dxOutlook365Sync1.ImportOutlookToSchedulerAsync(false);
    // Hides the wait form.
    splashScreenManager1.CloseWaitForm();
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ImportOutlookToSchedulerAsync(Boolean) method.

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.

See Also