PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • How to manage a Google calendar?
  • Managing a Google calendar
  • Creating a Google calendar
  • Note
  • How to retrieve a Google calendar and its elements?
  • 1st method: retrieving the list of calendars and retrieving their events
  • 2nd method: retrieving a specific calendar
  • How to add, modify or delete events in a Google calendar?
  • Principle
  • Adding events to a calendar
  • Modifying the events in a calendar:
  • Deleting an event from a calendar
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The Google Calendar service is an Internet application provided by Google that is used to manage a calendar on Internet.
WINDEV and WEBDEV allow you to create an application for synchronizing schedules with an existing application for example: using a meeting room, a vehicle, ...
These WLanguage functions also allow you to develop specific interfaces (suited for your business requirements, more user-friendly, ...) and to add specific processes (prints, ...).
Examples of processes that can be implemented natively in WLanguage:
  • Retrieving the detailed list of calendars (professional calendars, personal calendars, ...).
  • Retrieving the list of appointments from a calendar.
  • Performing a search in the appointments of a calendar.
  • Adding, modifying and deleting appointments.
Warning: Before using a feature linked to Google services, we strongly recommend that you check the license for using this service. Some restrictions may apply. The content of licenses may change over time.
PC SOFT is in no case responsible for the way the native access functions are used. Make sure that you comply with the license of service provider.
How to manage a Google calendar?

Managing a Google calendar

To manage a Google calendar:
  1. Create a Google account if necessary. This account can be created via the following address: https://www.google.com/accounts/NewAccount?hl=fr
    Caution: the address of this page may have been modified since the publication date of this page.
    The Google account is identified by an email address and the associated password.
  2. In the code of your application, create a gglConnection variable. This variable contains the characteristics of the connection to your Google account.
Caution: the access to the Google Calendars changes from November 17, 2014
From November 17 2014, Google is only using the Google API version 3 (Google API version 2 is abandoned). This change of version has modified the exchange format of data used by the functions for accessing the Google Calendars.
An "OAuth 2.0" authentication is now required to access this service. This authentication mode requires:
  • the declaration of the application in the Google console. To use the Google Calendars, the application must use the "Calendar API" service.
  • the use of new properties in the gglConnection variable.
See the help about GglConnect for more details.
Caution: The gglCalendar, gglEvent and gglLocation variables are also modified. Some properties become obsolete with the Google API version 3: they must not be specified anymore.

Creating a Google calendar

A Google calendar can be created via the Google interface or by programming with the WLanguage functions.
To create a Google calendar with the WLanguage functions:
  1. Create a gglCalendar variable.
  2. Define the characteristics of the calendar via the gglCalendar properties.
  3. Define (if necessary) the events linked to the calendar (gglEvent variable).
  4. Validate the creation of the calendar with GglWrite.

Note

If you are using a proxy to access Internet, the proxy must be configured (Proxy) to use the Google functions.
How to retrieve a Google calendar and its elements?

1st method: retrieving the list of calendars and retrieving their events

To retrieve a Google calendar from the list of calendars:
  1. Declare an array of gglCalendar variables (to retrieve several calendars).
  2. Use GglListCalendar. This function is used to list the available calendars. The calendars found are assigned to the array of gglCalendar variables.
  3. Use GglFillCalendar to retrieve the events. The events can be retrieved from a single calendar or from several calendars. The events to retrieve can be filtered (between two dates for example).
Example:
arrCalendars is array of 0 gglCalendar
arrCalendars = GglListCalendar(Cnt)
// First calendar
Calendar is gglCalendar = arrCalendars[1]
// Retrieves the events between 01/01/2008 and 01/01/2009 included
GglFillCalendar(Cnt, Calendar, "20080101", "20090102")
// Browse the events of a calendar
Evt is gglEvent
FOR EACH Evt OF Calendar
Trace(Evt..Title)
END

2nd method: retrieving a specific calendar

To retrieve a specific Google calendar as well as its events:
  1. Declare an gglCalendar variable.
  2. Use GglGetCalendar. This function is used to retrieve the Google calendar (and its events) corresponding to the specified title.
Example:
// Retrieve the calendar named "Work"
Calendar is gglCalendar = GglGetCalendar(Cnt, "Work")
// Browse the events of the calendar
IF ErrorOccurred = False THEN
Evt is gglEvent
FOR EACH Evt OF gglCalendar
Trace(Evt..Title)
END
END
How to add, modify or delete events in a Google calendar?

Principle

The principle for modifying the events is straightforward: the calendar is retrieved locally, the modifications are performed locally and the calendar is updated on the server.
Note: For shared calendars, we advise you to regularly update the calendars on the server.

Adding events to a calendar

To add events to a calendar:
  1. Retrieve the requested calendar (and its events if necessary).
  2. Declare an gglEvent variable.
  3. Define the characteristics of the event via the properties of the variable.
  4. Use GglWrite to update the calendar on the server.
Example:
// Retrieve the calendar named "Work"
Calendar is gglCalendar = GglGetCalendar(Cnt, "Work")

// Create an event
MyEvent is gglEvent
MyEvent..StartDate = "20081201085000"
MyEvent..EndDate = "20081201093000"
MyEvent..Title = "Appointments"
MyEvent..Content = "Appointment regarding the status report for November"

// Add the event into the calendar
Add(Calendar..Event, MyEvent)

// Update the calendar on the server
GglWrite(Cnt, Calendar)
arrCalendars is array of 0 gglCalendar
arrCalendars = GglListCalendar(Cnt)

// Retrieves the future events of the first calendar
GglFillCalendar(Cnt, arrCalendars[1])

// Create an event
MyEvent is gglEvent
MyEvent..StartDate = "20081201085000"
MyEvent..EndDate = "20081201093000"
MyEvent..Title = "Appointments"
MyEvent..Content = "Appointment regarding the status report for November"

// Add the event into the calendar
Add(arrCalendars[1]..Event, MyEvent)

// Update the calendar on the server
GglWrite(Cnt, arrCalendars[1])

Modifying the events in a calendar:

To modify the events in a calendar:
  1. Retrieve the requested calendar and its events.
  2. Find the event to modify.
  3. Modify the characteristics of the event.
  4. Validate the modifications with GglWrite.
Note: Several modifications can be performed before using GglWrite.
Example:
// Retrieve the calendar named "Work"
Calendar is gglCalendar = GglGetCalendar(Cnt, "Work")
// Modify the first event of the calendar
Calendar..Event[1]..Title = "Apt with boss"
Calendar..Event[1]..EndDate = "200810131530"
// Actually update the changes on the server
GglWrite(Cnt, Calendar)

Deleting an event from a calendar

To delete an event from a calendar:
  1. Retrieve the requested calendar and its events.
  2. Find the event to delete.
  3. Delete the event.
  4. Validate the modifications with GglWrite.
Note: Several deletions can be performed before using GglWrite.
Example:
// Retrieve the calendar named "Work"
Calendar is gglCalendar = GglGetCalendar(Cnt, "Work")
// Delete the second event from the calendar
Delete(Calendar..Event, 2)
// Actually update the changes on the server
GglWrite(Cnt, Calendar)
Related Examples:
The Organizer control (displaying a Google calendar) Unit examples (WINDEV): The Organizer control (displaying a Google calendar)
[ + ] Retrieving events from a Google calendar via the gglXxx functions and displaying these events in an Organizer control.
WD Organizer Complete examples (WINDEV): WD Organizer
[ + ] This example is used to synchronize some appointments between your Outlook, Lotus Notes and Google calendars.

Based on the Organizer control, you have the ability to create, modify, move or delete the appointments.
you also have the ability to classify the appointments by category and to link them to several external organizers.
WD Schedule Complete examples (WINDEV): WD Schedule
[ + ] This example presents the management of a graphic schedule.

The following topics are presented in this example:
1/ the scheduler control
2/ the Google Calendar functions
Minimum required version
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment