Back to Devexpress

AppointmentSynchronizer.ForeignIdFieldName Property

corelibraries-devexpress-dot-xtrascheduler-dot-exchange-dot-appointmentsynchronizer.md

latest6.6 KB
Original Source

AppointmentSynchronizer.ForeignIdFieldName Property

Gets or sets the field name that contains the Foreign ID in the third-party scheduling application (MS Outook) database with which appointment data is exchanged.

Namespace : DevExpress.XtraScheduler.Exchange

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

NuGet Package : DevExpress.Scheduler.Core

Declaration

csharp
public string ForeignIdFieldName { get; set; }
vb
Public Property ForeignIdFieldName As String

Property Value

TypeDescription
String

A String representing the name of the field containing the Foreign Id.

|

Remarks

MS Outlook synchronization uses the OutlookImportSynchronizer and OutlookExportSynchronizer classes, derived from the AppointmentSynchronizer class. Before calling the AppointmentSynchronizer.Synchronize method, you can specify the location of the calendar folder and the name of the database field to store the MS Outlook identifier of an imported event.

The calendar folder name is accessible via the CalendarFolderName property, and can be left empty. In this situation, the default Outlook calendar is used. You can get a list of calendar folders via the DevExpress.XtraScheduler.Outlook.OutlookExchangeHelper.GetOutlookCalendarFolders method.

The ForeignIdFieldName property enables you to specify the data field name intended to hold a foreign (MS Outlook) appointment identifier. This is important, because during synchronization an appointment in the Scheduler storage is matched with the corresponding MS Outlook event using this identifier. The database field can have any name (e.g. “OutlookEntryID”) and should be able to hold a long sequence of characters (e.g. nvarchar(256) in MS Access).

To get the foreign ID of an appointment for your purposes, you can utilize the IGetAppointmentForeignId interface in the AppointmentSynchronizer.AppointmentSynchronized event handler:

csharp
void synchronizer_AppointmentSynchronized(object sender, 
    DevExpress.XtraScheduler.AppointmentSynchronizedEventArgs e)
    {                                                         
        object outlookID = ((IGetAppointmentForeignId)sender).GetForeignId(e.Appointment);
    }
vb
Private Sub synchronizer_AppointmentSynchronized(ByVal sender As Object, _ 
ByVal e As DevExpress.XtraScheduler.AppointmentSynchronizedEventArgs)
    Dim outlookID As Object = (CType(sender, IGetAppointmentForeignId)).GetForeignId(e.Appointment)
End Sub

Another way to obtain the foreign appointment ID is to handle the AppointmentExchanger.GetAppointmentForeignId event.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ForeignIdFieldName property.

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-sync-outlook-calendars/CS/SyncWithOutlook/OutlookSynchronizerHelper.cs#L42

csharp
_outlookEntryIDFieldName = value;
if(importSynchronizer != null) importSynchronizer.ForeignIdFieldName = _outlookEntryIDFieldName;
if(exportSynchronizer != null) exportSynchronizer.ForeignIdFieldName = _outlookEntryIDFieldName;

winforms-scheduler-sync-with-outlook/CS/SyncWithOutlook/Form1.cs#L48

csharp
// 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.

winforms-scheduler-sync-outlook-calendars/VB/SyncWithOutlook/OutlookSynchronizerHelper.vb#L60

vb
If importSynchronizer IsNot Nothing Then
    importSynchronizer.ForeignIdFieldName = _outlookEntryIDFieldName
End If

winforms-scheduler-sync-with-outlook/VB/SyncWithOutlook/Form1.vb#L49

vb
' 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.

See Also

Synchronization with Microsoft Outlook

AppointmentSynchronized

GetAppointmentForeignId

AppointmentSynchronizer Class

AppointmentSynchronizer Members

DevExpress.XtraScheduler.Exchange Namespace