oauth2.GetAccessToken
Wait For OAuth2_AccessTokenAvailable (Success As Boolean, token As String)
If Success = False Then
Log("Error accessing account.")
Return
Else
Log($"Success = ${Success}"$)
Log($"Token = ${token}"$)
' kvs.Put("Token",token)
GCal.Initialize("Calendar","GCal",ClientId,ClientSecret,Null,token)
Dim c As Calendar = GCal.Calendar
Log("Calendar Object")
Log(c)
Log(c.RootUrl)
events = c.Events ' events is a global Var.
' Once set you can use it for further operations.
' It is a important Object...
Log("Events Object")
Log(events)
Log("CalendarList")
Dim cl As CalendarList = GCal.calendarList
Log(cl)
Dim calendarslist As List = cl.Items
If calendarslist <> Null And calendarslist.IsInitialized And calendarslist.Size > 0 Then
For i=0 To calendarslist.Size-1
Dim entry As CalendarListEntry = calendarslist.Get(i)
Log($"=========== CALENDAR ==========================="$)
Log(entry.Etag)
Log(entry.Id)
'If entry.Id.Contains("xxxxx") Then ' work with the Calendar you want to
Dim eventslist As List = events.List(entry.Id) ' Get all Events from the given Calendar.
If eventslist.IsInitialized And eventslist.Size>0 Then
Log("Events "&entry.Id)
Log(eventslist.Size)
For o= 0 To eventslist.Size-1
Log($"=========== EVENT ==========================="$)
Dim event As Event = eventslist.Get(o)
Log(event)
Log(event.Id)
Log(event.Description)
Log(event.Location)
Log(event.Start)
Log(event.End)
Log(event.Etag)
Next
End If
'events
' End If
Next
End If
End If