[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
    Getting Started
   [Expand]Scheduler Elements and Structure
   [Expand]Data Binding
   [Expand]Appointments
   [Expand]Views
   [Collapse]Import and Export
     Synchronization with Microsoft Outlook
     iCalendar Support
     VCalendar 1.0 Support
     Google Calendars
    Printing
   [Expand]Reports
   [Expand]Time Zones
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
   [Expand]Services
   [Expand]Member Tables
   [Expand]Visual Elements
   [Expand]Examples
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Google Calendars

DevExpress Scheduler can synchronize its regular, recurring and all-day Appointments (in Google terminology, "Events") with Google Calendars. The synchronization process works in a two-way mode: you cannot only import or export data to the control/Google calendar.

The Scheduler control uses the DXGoogleCalendarSync component to transfer data between a Google calendar and a control storage (both SchedulerDataStorage and its predecessor SchedulerStorage are supported).

In this document:

Useful resources:

Expanded Limitations

Currently, synchronization between Scheduler and Google calendars has the following limitations.

Expanded Tutorial

The steps below illustrate how to build a sample application that exchanges Appointments/Events between an unbound SchedulerControl and Google calendars.

To browse complete sample code and download the Visual Studio project, visit the How To: Synchronize Scheduler Control Appointments with Google Calendar Events GitHub example.

Expanded Prerequisites

  1. Start a new Visual Studio project and select the "Scheduling Application" template from the DevExpress Template Gallery.
  2. Create a new Ribbon group and add a regular push button (BarButtonItem) and an edit item (BarEditItem) with the RepositoryItemComboBox editor within.

  3. Change the button name to "bbiSynchronize" and RepositoryItem name to "ricbCalendarList" to avoid errors when you copy-and-paste code snippets from this article.
  4. Invoke the SchedulerControl's smart-tag menu and choose "Add DX Google Calendar Synchronizer". This link invokes a confirmation dialog that asks for the permission to install several NuGet packages.

    Click "Install" to add the DXGoogleCalendarSync component and all required libraries to the project.

Expanded Turn on the Google Calendar API

Open the Google Calendar API .NET Quickstart documentation article and follow steps 1 to 3b to acquire the "credentials.json" file and include it into your project.

Expanded Set up the sample

  1. Override the OnLoad method to specify the DXGoogleCalendarSync component's DXGoogleCalendarSync.CalendarService property and log into Google services using the credentials file you downloaded.

  2. Add the following code to extract the calendar list and populate the combo box editor in the Ribbon with corresponding items. The "UpdateBbiAvailability" method disables the "Sync" button if there is no selected calendar.

  3. When the combo box shows available calendars, you can handle the item selection, retrieve the selected calendar's ID and pass it to the component DXGoogleCalendarSync.CalendarId property.

  4. To start synchronization, call the DXGoogleCalendarSync.Synchronize method.

  5. Specify the DXGoogleCalendarSync.Storage property to bind Google Calendar to a SchedulerDataStorage or SchedulerStorage object.

  6. The sample application is now ready. At first launch, it will ask you to sign in with any Google account (this does not have to be the same account you used to download the "credentials.json" file).

    In case of a successful sign-in, user credentials are saved to the "%Documents%\.credentials\GoogleSchedulerSync.json\Google.Apis.Auth.OAuth2.Responses.TokenResponse-user" file.

Expanded Identify Appointments

All Google Events have two properties that establish Event identities:

  • ID - an opaque Event identifier that remains constant throughout the Event life cycle;
  • ETag - a hash code that changes with every Event modification.

The DXGoogleCalendarSync component automatically adds two Appointment custom fields (the IPersistentObject.CustomFields collection) to store these identifiers: "gID" and "etag". You can use the DXGoogleCalendarSync.CustomFieldIdPropertyName and DXGoogleCalendarSync.CustomFieldETagPropertyName component properties to change these default custom field names.

If you want to store ID and ETag values in a data source bound to your storage, add corresponding custom field mappings.

Expanded Skip Unwanted Appointments and Events

If for specific Scheduler Appointments no matching Google Calendar Events should be created (or vice versa), handle the DXGoogleCalendarSync.FilterAppointments event.

The sample below illustrates how to skip all appointments that have "test" in their descriptions, and all Google Events with the "tentative" status.

Expanded Resolve Synchronization Conflicts

If you make different edits to both a Scheduler Appointment and a Google Calendar Event, the DXGoogleCalendarSynch component is unable to identify which of these objects holds valid data. To resolve such inconsistencies, the component fires DXGoogleCalendarSync.ConflictDetected events. Handle this event and set its ConflictDetectedEventArgs.GoogleEventIsValid parameter to false if a Scheduler Appointment is valid and should be copied into a Google Calendar.

If the DXGoogleCalendarSync.ConflictDetected event is not handled, the DXGoogleCalendarSync component always prioritizes Google Events over Scheduler Appointments when conflicts emerge.

Critical conflicts raise a different event, DXGoogleCalendarSync.OnException. Handle this event and read its e.Exception parameter to learn about conflict details.

Is this topic helpful?​​​​​​​