Skip to main content
All docs
V25.2
  • DXOutlook365Sync.ExportSchedulerToOutlookAsync(Boolean) Method

    Exports the Scheduler’s appointments to Outlook 365 calendars with synchronization enabled.

    Namespace: DevExpress.XtraScheduler.Microsoft365Calendar

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

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

    Declaration

    public Task ExportSchedulerToOutlookAsync(
        bool canRemoveOutlookEvents
    )

    Parameters

    Name Type Description
    canRemoveOutlookEvents Boolean

    true to clear Outlook 365 calendars before export; otherwise, false.

    Returns

    Type Description
    Task

    The asynchronous operation.

    Remarks

    Important

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

    The ExportSchedulerToOutlookAsync method exports the appointments from the Scheduler control to the Office365 calendars with synchronization enabled (EnableSynchronization). Appointments that do not have corresponding events in Outlook 365 are exported to the default calendar in Office365.

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

    Example: Export Appointments to Outlook365

    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 if the initialization of 'dxOutlook365Sync1' failed.
        return status != InitStatus.Error;
    }
    private async void exportAppointmentsButton_Click(object sender, EventArgs e) {
        // Checks whether the initialization of 'dxOutlook365Sync1' failed.
        if(!await InitOutlook365Sync(dxOutlook365Sync1)) return;
        splashScreenManager1.ShowWaitForm();
        // Exports the Scheduler control's appointments to Outlook365.
        await dxOutlook365Sync1.ExportSchedulerToOutlookAsync(false);
        splashScreenManager1.CloseWaitForm();
    }
    private void DxOutlook365Sync1_InitComplete(object sender, InitCompleteEventArgs e) {
        if(e.InitStatus == InitStatus.Error)
            XtraMessageBox.Show(String.Format("Initialization of DXOutlook365Sync failed. {0}", e.Exception.Message), "Error", MessageBoxButtons.OK);
    }
    

    The following code snippets (auto-collected from DevExpress Examples) contain references to the ExportSchedulerToOutlookAsync(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