AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Comunicación / Funciones Google / Google Calendar
  • Example: Browsing Google calendars
  • Example: Writing an event into the Google calendar
  • Example: Finding an event in the Google calendar
GglListCalendar (Example)
Example: Browsing Google calendars
This example is used to browse the different calendars of a Google account. The associated events are browsed for each calendar and the associated locations are browsed for each event.
// Connection to Google
Cnt is gglConnection
...
 
// Retrieve the array of available calendars
arrCalendars is array of gglCalendar
arrCalendars = GglListCalendar(Cnt)
 
// Browse
arrCalendarsBrowseEvent is gglCalendar
ACalendar is gglCalendar
AnEvent is gglEvent
ALocation is gglLocation
 
// Browse all the available calendars and retrieve the events
FOR EACH ELEMENT ACalendar OF arrCalendars
Trace("Calendar " + ACalendar.Title + ...
 " (updated on " + DateToString(ACalendar.UpdateDate[[TO 8]]) + ...
 " à " + TimeToString(ACalendar.UpdateDate[[9 À]]) + ")")
arrCalendarsBrowseEvent = GglGetCalendar(Cnt, ACalendar.Identifier)
 
// Browse all the events found in the current calendar
FOR EACH AnEvent OF arrCalendarsBrowseEvent
Trace("------------------------------")
Trace(AnEvent.Title)
Trace("From " + DateToString(AnEvent.StartDate[[À 8]]) + ...
  " to " + TimeToString(AnEvent.StartDate[[9 À]]) + ")" + ...
  " to " + DateToString(AnEvent.EndDate[[TO 8]]) + " at " + ...
  TimeToString(AnEvent.EndDate[[9 TO]]) + ")")  
 
// Browse the locations of the event
FOR EACH ELEMENT ALocation OF AnEvent.Location
Trace("Location of the event: " + ALocation.Value + "//" + ALocation.Caption)
END
END
END
Example: Writing an event into the Google calendar
This example is used to write an event into the selected Google calendar.
MyConnection is gglConnection
MyCalendar is gglCalendar
MyEvent is gglEvent
arrMyCalendars is array of gglCalendars
i is int
 
...
 
// Retrieve the calendar
arrMyCalendars = GglListCalendar(MyConnection)
i = ArraySeek(arrMyCalendars, asLinear, "Title", "Test")
IF i = -1 THEN
MyCalendar.Title = "Test"
ELSE
MyCalendar = GglGetCalendar(MyConnection, "Test")
END
 
// Create the event
MyEvent.Content = "STG"
MyEvent.StartDate = "20160906000000"
MyEvent.EndDate = "20160907000000"
MyEvent.WholeDay = True
MyEvent.Title = "STG"
 
 
// Add the event into the calendar and write this one
Add(MyCalendar.Event, MyEvent)
IF NOT GglWrite(MyConnection, MyCalendar) THEN
Error(ErrorInfo())
END
Example: Finding an event in the Google calendar
This example explains how to find an event in a Google calendar
MyConnection is gglConnection
MyCalendar is gglCalendar
MyEvent is gglEvent
arrMyCalendars is array of gglCalendars
i is int
sMyEvent is string
 
...
 
// Retrieve the calendar
arrMyCalendars = GglListCalendar(MyConnection)
i = ArraySeek(arrMyCalendars, asLinear, "Title", "STG")
IF i = -1 THEN
MyCalendar.Title = "Test"
ELSE
// Retrieve the event
MyCalendar = GglGetCalendar(MyConnection, "STG")
MyEvent = MyCalendar.Event[1]
END
 
sMyEvent += [CR] + "Content: " + MyEvent.Content
sMyEvent += [CR] + "StartDate: " + MyEvent.StartDate
sMyEvent += [CR] + "EndDate: " + MyEvent.EndDate
sMyEvent += [CR] + "WholeDay: " + MyEvent.WholeDay
sMyEvent += [CR] + "Title: " + MyEvent.Title
 
Info(sMyEvent)
Versión mínima requerida
  • Versión 14
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local