PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • 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, 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 linked to Google services, we strongly recommend that you check the license for using this 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 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.

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 <gglConnection variable>.Write.

Note

If you are using a proxy to access Internet, the proxy must be configured (with 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 <gglConnection variable>.ListCalendar. 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 example).
Example:
Cnt is gglConnection
...
arrCalendars is array of 0 gglCalendar
arrCalendars = Cnt.ListCalendar()
// First calendar
Calendar is gglCalendar = arrCalendars[1]
// Retrieve the events between 01/01/2008 and 01/01/2009 included
Cnt.FillCalendar(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 a gglCalendar variable.
  2. Use <gglConnection variable>.GetCalendar. This function is used to retrieve the Google calendar (and its events) corresponding to the specified title.
Example:
Cnt is gglConnection
...

// Retrieve the calendar named "Work"
Calendar is gglCalendar = Cnt.GetCalendar("Work")
// Browse the events of the calendar
IF ErrorOccurred = False THEN
Evt is gglEvent
FOR EACH Evt OF Calendar
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 a gglEvent variable.
  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:
Cnt is gglConnection
...
 
// Retrieve the calendar named "Work"
Calendar is gglCalendar = Cnt.GetCalendar("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
Cnt.Write(Calendar)
 
Cnt is gglConnection
...
 
arrCalendars is array of 0 gglCalendar
arrCalendars = Cnt.ListCalendar()
 
// Retrieve the future events of the first calendar
Cnt.FillCalendar(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
Cnt.Write(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 <gglConnection variable>.Write.
Note: You can make several changes before using <gglConnection variable>.Write.
Example:
Cnt is gglConnection
...

// Retrieve the calendar named "Work"
Calendar is gglCalendar = Cnt.GetCalendar("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
Cnt.Write(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 <gglConnection variable>.Write.
Note: Several deletions can be performed before using <gglConnection variable>.Write.
Example:
Cnt is gglConnection
...
 
// Retrieve the calendar named "Work"
Calendar is gglCalendar = Cnt.GetCalendar("Work")
// Delete the second event from the calendar
Delete(Calendar..Event, 2)
// Actually update the changes on the server
Cnt.Write(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 version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment