ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Google functions / Google Calendar
  • Overview
  • How to manage a Google calendar?
  • Managing a Google calendar
  • Creating a Google calendar
  • Remark
  • How to retrieve a Google calendar and its elements?
  • 1st method: retrieving the list of calendars then 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
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
The Google Calendar service is an Internet application provided by Google that is used to manage a calendar on Internet.
For example, WINDEV and WEBDEV can be used to synchronize schedules with existing applications, such as meeting rooms or vehicles.
These WLanguage functions also allow you to develop specific interfaces (suited for your business requirements, more user-friendly, etc.) and to add specific processes (prints, among others).
Examples of processes that can be implemented natively in WLanguage:
  • Retrieving the detailed list of calendars (professional calendars, personal calendars, etc.).
  • 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 related to Google services, we strongly advise you to refer to the license agreement for that service.. Some restrictions may apply. The content of the 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 the 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 changed since this page was written.
    The Google account is identified by an email address and the associated password.
  2. In the code of your application, create a variable of type gglConnection. This variable contains the characteristics of the connection to your Google account.

Creating a Google calendar

A Google calendar can be created via the Google interface or through programming with the WLanguage functions.
To create a Google calendar with the WLanguage functions:
  1. Create a variable of type gglCalendar.
  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 <gglConnection variable>.Write.

Remark

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

1st method: retrieving the list of calendars then 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 the <gglConnection variable>.ListCalendar function. This function is used to list the available calendars. The calendars found are assigned to the array of gglCalendar variables.
  3. Use <gglConnection variable>.FillCalendar 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 instance).
Example:
Cnx is gglConnection
...
tabAgendas is array of 0 gglCalendar 
tabAgendas = Cnx.ListCalendar() 
// Premier agenda
Agenda is gglCalendar = tabAgendas[1]
// Récupère les événements entre le 01/01/2008 et le 01/01/2009 inclus
Cnx.FillCalendar(Agenda, "20080101", "20090102")
// Parcours des événements d'un agenda
Evt is gglEvent
FOR EACH Evt OF Agenda 
	Trace(Evt.Title)
END

2nd method: retrieving a specific calendar

To retrieve a specific Google calendar as well as its events:
  1. Declare a variable of type gglCalendar.
  2. Use the <gglConnection variable>.GetCalendar function. This function is used to retrieve the Google calendar (and its events) corresponding to the specified title.
Example:
Cnx is gglConnection
...
// Récupération de l'agenda nommé "Travail"
Agenda is gglCalendar = Cnx.GetCalendar("Travail")
// Parcours des événements de l'agenda
IF ErrorOccurred = False THEN
	Evt is gglEvent
	FOR EACH Evt OF Agenda
		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: In the case of shared calendars, it is advisable 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 a variable of type gglEvent.
  3. Define the characteristics of the event via the properties of the variable.
  4. Use <gglConnection variable>.Write to update the calendar on the server.
Example: Creating an event in the "Work" calendar:
Cnx is gglConnection
...
// Récupération de l'agenda nommé "Travail"
Agenda is gglCalendar = Cnx.GetCalendar("Travail")
// Création d'un événement
MonEvénement is gglEvent
MonEvénement.StartDate = "20081201085000"
MonEvénement.EndDate = "20081201093000"
MonEvénement.Title = "Rendez-vous"
MonEvénement.Content = "Rendez-vous concernant le bilan du mois de novembre"
// Ajout de l'événement dans l'agenda
Add(Agenda.Event, MonEvénement)
// Mise à jour de l'agenda sur le serveur
Cnx.Write(Agenda)
Example: Creating an event on the first calendar found:
Cnx is gglConnection
...
tabAgendas is array of 0 gglCalendar 
tabAgendas = Cnx.ListCalendar() 
// Récupère les événements futurs du premier agenda
Cnx.FillCalendar(tabAgendas[1])
// Création d'un événement 
MonEvénement is gglEvent
MonEvénement.StartDate = "20081201085000"
MonEvénement.EndDate = "20081201093000"
MonEvénement.Title = "Rendez-vous"
MonEvénement.Content = "Rendez-vous concernant le bilan du mois de novembre"
// Ajout de l'événement dans l'agenda
Add(tabAgendas[1].Event, MonEvénement)
// Mise à jour de l'agenda sur le serveur
Cnx.Write(tabAgendas[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 <gglConnection variable>.Write.
Note: You can make several changes before using the <gglConnection variable>.Write function.
Example:
Cnx is gglConnection
...
// Récupération de l'agenda nommé "Travail"
Agenda is gglCalendar = Cnx.GetCalendar("Travail")
// Modification du premier événement de l'agenda
Agenda.Event[1].Title = "Rdv patron"
Agenda.Event[1].EndDate = "200810131530"
// Mise à jour effective des changements sur le serveur
Cnx.Write(Agenda)

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 <gglConnection variable>.Write.
Note: It is possible to make several deletions before using the <gglConnection variable>.Write function.
Example:
Cnx is gglConnection
...
// Récupération de l'agenda nommé "Travail"
Agenda is gglCalendar = Cnx.GetCalendar("Travail")
// Suppression du deuxième événement de l'agenda
Delete(Agenda.Event, 2)
// Mise à jour effective des changements sur le serveur
Cnx.Write(Agenda)
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 version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/20/2024

Send a report | Local help