This example illustrates how to use Google Calendar API to synchronize ASPxScheduler with Google Calendar. Google provides the corresponding guidelines regarding the use of this API:
Google Calendar API
Before using this API, make certain you have read and are in compliance with Google’s licensing terms. Next, you’ll need to generate a JSON file with OAuth 2.0 credentials to enable the Google Calendar API.
We have a corresponding KB article which contains a step-by-step description of how to generate this JSON file for the installed application type:
How to enable the Google Calendar API to use it in your application
The the OAuth 2.0 flow both for authentication and for obtaining authorization is similar to the one for Web Server Applications except three points:
1) When creating a client ID, you specify that your application is an Installed application. This results in a different value for the redirect_uri
parameter.
2) The client ID and client secret obtained from the API Console are embedded in the source code of your application. In this context, the client secret is obviously not treated as a secret.
3) The authorization code can be returned to your application in the title bar of the browser or in the query string of an HTTP request to the local host.
Please refer to Google OAuth 2.0 documentation for more information.
After you generate this JSON file, start the "oauth2callback.aspx" page for authorization.
1. Enter the email address you used to generate the JSON file.
2. Select the JSON file on the client machine by clicking the "Browse" button.
3. Click the "Get 'Client ID' and 'Client secret' from file" button to upload the selected file and enable the Google Calendar API.
4. The application should be navigated to the "Default.aspx" page.
5. Select a corresponding calendar to synchronize with the scheduler storage.
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
The synchronization procedure implemented in this example has the following limitations:
- Recurring appointments are excluded
- Statuses, labels, reminders, and resource associations are not synchronized.