|
|
|
|
|
- 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
Managing Google Calendars (prefix syntax)
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: - 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. - 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: - Create a variable of type gglCalendar.
- Define the characteristics of the calendar via the gglCalendar properties.
- Define (if necessary) the events linked to the calendar (gglEvent variable).
- 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: - Declare an array of gglCalendar variables (to retrieve several calendars).
- 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.
- 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()
Agenda is gglCalendar = tabAgendas[1]
Cnx.FillCalendar(Agenda, "20080101", "20090102")
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: - Declare a variable of type gglCalendar.
- 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
...
Agenda is gglCalendar = Cnx.GetCalendar("Travail")
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: - Retrieve the requested calendar (and its events if necessary).
- Declare a variable of type gglEvent.
- Define the characteristics of the event via the properties of the variable.
- Use <gglConnection variable>.Write to update the calendar on the server.
Example: Creating an event in the "Work" calendar:
Cnx is gglConnection
...
Agenda is gglCalendar = Cnx.GetCalendar("Travail")
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"
Add(Agenda.Event, MonEvénement)
Cnx.Write(Agenda)
Example: Creating an event on the first calendar found:
Cnx is gglConnection
...
tabAgendas is array of 0 gglCalendar
tabAgendas = Cnx.ListCalendar()
Cnx.FillCalendar(tabAgendas[1])
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"
Add(tabAgendas[1].Event, MonEvénement)
Cnx.Write(tabAgendas[1])
Modifying the events in a calendar: To modify the events in a calendar: - Retrieve the requested calendar and its events.
- Find the event to modify.
- Modify the characteristics of the event.
- Validate the modifications with <gglConnection variable>.Write.
Example:
Cnx is gglConnection
...
Agenda is gglCalendar = Cnx.GetCalendar("Travail")
Agenda.Event[1].Title = "Rdv patron"
Agenda.Event[1].EndDate = "200810131530"
Cnx.Write(Agenda)
Deleting an event from a calendar To delete an event from a calendar: - Retrieve the requested calendar and its events.
- Find the event to delete.
- Delete the event.
- 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
...
Agenda is gglCalendar = Cnx.GetCalendar("Travail")
Delete(Agenda.Event, 2)
Cnx.Write(Agenda)
Related Examples:
|
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.
|
|
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.
|
|
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
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|