Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to import Google Calendar using Google Calendar API

$
0
0

This example demonstrates how you can use the Google Calendar API in your scheduling application. Google provides the corresponding guidelines regarding use of this API:
Google Calendar API 

Before using this API, make certain you have read and understand Google’s licensing terms. Next, you’ll need to generate a corresponding JSON file with credentials to enable the Google Calendar API.

We have a corresponding KB article which contains step-by-step description on how to generate this JSON file:
How to enable the Google Calendar API to use it in your application

After you generate this JSON file and put it in the Secret folder of this sample project, you can import appointments from a Google calendar into the SchedulerControl;
1. Click the "Connect" button to generate a list of available calendars for your Google account
2. Select a corresponding calendar from which to import appointments.
For importing appointments, we created a corresponding CalendarImporter class which creates Appointment instances based on loaded Event (Google.Apis.Calendar.v3.Data) instances.

Appointment entries obtained via the Google API are objects of the Google.Apis.Calendar.v3.Data.Event type. Each appointment entry is processed to create an XtraScheduler appointment, recurrence pattern or exception. To parse recurrence information contained within the appointment entry, a RecurrencePatternParser class is implemented. It creates the DevExpress.XtraScheduler.iCalendar.iCalendarEntryParser instance to parse recurrence information represented by a string in iCalendar format. The DevExpress.XtraScheduler.iCalendar.iCalendarEntryParser instance holds the parse results and provides access to property values by property names.
Note that a special method is required to link exceptions (changed or deleted occurrences) with their patterns, since they are created independently while processing Google appointment entries.

P.S. To run this example's solution, include the corresponding "Google Calendar API" assemblies into the project.
For this, open the "Package Manager Console" (Tools - NuGet Package Manager) and execute the following command:

Install-Package Google.Apis.Calendar.v3

 

Question Comments

Added By: Marco Calabri at: 7/10/2013 1:28:41 AM    

good morning to all,
thanks for the example
how can I import the "Description" field from Google Calendar?
thanks for your help

Added By: subbu .B at: 10/10/2013 10:48:16 PM    

Hi,
I need help.How can i implement same code in my windows phone app using c#.
Thnaks,

Added By: Stephen Wright at: 7/4/2015 1:01:28 PM    

Thanks for the example. I have downloaded the latest DLL's from the website. The code fails on line 111

UserProfile.Instance.Calendars = (CalendarFeed)service.Query(query);

the catch then says it is an invalid username/password. But I know these to be correct because I use them to login via chrome.
Can someone suggest what I've left out.

Regards.

Added By: Oleg (DevExpress Support) at: 7/6/2015 3:36:33 AM    

Hello Stephen,
We were able to reproduce the issue. It seems that something was changed in Google API. We need additional time to investigate the issue on our side and find a corresponding solution.
We will update the status of this ticket once we have any results.

Added By: Stephen Wright at: 7/6/2015 4:03:57 AM    

Thank you. Trawling through the system, it appears that oAuth is the way to get in, but working that out is like wading through treacle.
I know I have the export .ics on the schedulergrid but I have to delete all the calendar entries and then re-import as the web interface doesn't check for duplicates.


Viewing all articles
Browse latest Browse all 7205

Trending Articles