Ejemplo n.º 1
0
        private void OutlookToCalendar()
        {
            AppointmentImportSynchronizer importer = this.schedulerStorage1.CreateOutlookImportSynchronizer();

            importer.ForeignIdFieldName = "EntryID";
            importer.Synchronize();
        }
        private void btnImport_Click(object sender, EventArgs e)
        {
            AppointmentImportSynchronizer importSynchronizer = schedulerControl1.Storage.CreateOutlookImportSynchronizer();

            importSynchronizer.ForeignIdFieldName = "ForeignOutlookId";
            ((ISupportCalendarFolders)importSynchronizer).CalendarFolderName = cbOutlookCalendars.Text;
            importSynchronizer.AppointmentSynchronizing += new DevExpress.XtraScheduler.AppointmentSynchronizingEventHandler(synchronizer_AppointmentSynchronizing);
            importSynchronizer.Synchronize();
        }
Ejemplo n.º 3
0
        private void ImportSync()
        {
            count = 0;

            AppointmentImportSynchronizer synchronizer = schedulerStorage1.CreateOutlookImportSynchronizer();

            synchronizer.AppointmentSynchronizing += new DevExpress.XtraScheduler.AppointmentSynchronizingEventHandler(synchronizer_AppointmentImportSynchronizing);
            synchronizer.AppointmentSynchronized  += new AppointmentSynchronizedEventHandler(synchronizer_AppointmentImportSynchronized);
            synchronizer.ForeignIdFieldName        = OutlookEntryIDFieldName;
            synchronizer.Synchronize();
            MessageBox.Show(string.Format("Synchronized {0} appointment(s); source objects count: {1}", count, synchronizer.SourceObjectCount), "Import successful", MessageBoxButtons.OK);
        }
Ejemplo n.º 4
0
        void synchronizer_OnException(object sender, ExchangeExceptionEventArgs e)
        {
            string errText = e.OriginalException.Message;
            OutlookExchangeExceptionEventArgs args = e as OutlookExchangeExceptionEventArgs;

            if (args != null)
            {
                if (args.OutlookAppointment != null)
                {
                    errText += String.Format("\r\nEvent '{0}' started on {1:D} at {2}\n", args.OutlookAppointment.Subject,
                                             args.OutlookAppointment.Start, args.OutlookAppointment.Start.TimeOfDay);
                }
            }
            AppointmentImportSynchronizer synchronizer = (AppointmentImportSynchronizer)sender;

            synchronizer.Terminate();
            e.Handled = true;
            throw e.OriginalException;
        }
        private void synchronizer_AppointmentSynchronizing(object sender, AppointmentSynchronizingEventArgs e)
        {
            OutlookAppointmentSynchronizingEventArgs args = (OutlookAppointmentSynchronizingEventArgs)e;
            Appointment apt = e.Appointment;

            AppointmentImportSynchronizer importSynchronizer = sender as AppointmentImportSynchronizer;
            AppointmentExportSynchronizer exportSynchronizer = sender as AppointmentExportSynchronizer;

            if (apt != null && args.OutlookAppointment != null)
            {
                if (importSynchronizer != null)
                {
                    apt.CustomFields[OutlookUserPropertyName] = GetOutlookAppointmentContactInfo(args.OutlookAppointment);
                }
                else
                {
                    SetOutlookAppointmentContactInfo(args.OutlookAppointment, Convert.ToString(apt.CustomFields[OutlookUserPropertyName]));
                }
            }
        }
        private void ImportSync()
        {
            count = 0;

            AppointmentImportSynchronizer synchronizer = schedulerStorage1.CreateOutlookImportSynchronizer();

            synchronizer.AppointmentSynchronizing += new DevExpress.XtraScheduler.AppointmentSynchronizingEventHandler(synchronizer_AppointmentImportSynchronizing);
            synchronizer.AppointmentSynchronized  += new AppointmentSynchronizedEventHandler(synchronizer_AppointmentImportSynchronized);
            synchronizer.ForeignIdFieldName        = OutlookEntryIDFieldName;

            Cursor oldCur = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;
            BeforeSynchronization(synchronizer.SourceObjectCount);
            try {
                synchronizer.Synchronize();
            }
            finally {
                AfterSynchronization();
                Cursor.Current = oldCur;
            }

            MessageBox.Show(string.Format("Synchronized {0} appointment(s); source objects count: {1}", count, synchronizer.SourceObjectCount), "Import successful", MessageBoxButtons.OK);
        }
Ejemplo n.º 7
0
 // Outlook --> Scheduler
 private void btnOutlookScheduler_Click(object sender, EventArgs e)
 {
     if (comboBoxEdit1.EditValue != null)
     {
         #region #outlook->scheduler
         AppointmentImportSynchronizer synchronizer = schedulerControl1.Storage.CreateOutlookImportSynchronizer();
         // Specify the field that contains appointment identifier used by a third-party application.
         synchronizer.ForeignIdFieldName = OutlookEntryIDFieldName;
         // The AppointmentSynchronizing event allows you to control the operation for an individual appointment.
         synchronizer.AppointmentSynchronizing += new AppointmentSynchronizingEventHandler(importSynchronizer_AppointmentSynchronizing);
         // The AppointmentSynchronized event indicates that the operation for a particular appointment is complete.
         synchronizer.AppointmentSynchronized += new AppointmentSynchronizedEventHandler(importSynchronizer_AppointmentSynchronized);
         // Specify MS Outlook calendar path.
         ((ISupportCalendarFolders)synchronizer).CalendarFolderName = comboBoxEdit1.EditValue.ToString();
         // Perform the operation.
         synchronizer.Synchronize();
         #endregion #outlook->scheduler
         memoEdit1.Text += "\r\n Import is done.\r\n\r\n";
     }
     else
     {
         MessageBox.Show("Please select an Outlook folder.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }