Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i am trying to read google Calendar into Mysql Database using VB
using the following code i found it works but only reads 25 records and seems to ignore date range, also we have multiple people on 1 calendar so how do we select which calendar we are looking at.

VB
Imports Google.GData.Calendar
Imports Google.GData.Extensions
Imports Google.GData.Client

  Dim srvce As New Google.GData.Calendar.CalendarService("GCal")
        Dim query As New FeedQuery
        Dim entr As EventEntry
       google_ac = fastlookup("google_account", "engine", "engid = " & gl_engid)
        google_pass = fastlookup("google_password", "engine", "engid = " & gl_engid)

        If nullstr(google_ac) = "" Then
            google_live = 0
        Else
            google_live = 1


            query.Uri = New Uri("https://www.google.com/calendar/feeds/default/private/full")
            'query.StartDate = "10/09/2012 06:00"     'optional but recommended so you don't get every single event, ever
            ' query.EndDate = "10/09/2012 12:00"      'optional
            query.ExtraParameters = "orderby=starttime&sortorder=ascending"   'optional but nice to have the events in order by date/time


            srvce.setUserCredentials(google_ac, google_pass)

            Dim calfeed As AtomFeed
            calfeed = srvce.Query(query)

            MsgBox(calfeed.Entries.Count)
            For Each entr In calfeed.Entries


                ' MsgBox(entr.Title.Text)
                eventid = entr.EventId.ToString
                ans = fastlookup("appointmentid", "workorder_appointments", "google_eventid = '" & eventid & "'")

                If nz(ans) = 0 Then
                    strsql = "insert into workorder_appointments (engid,appointment_title, " & _
                        " appointment_desc,Appointment_type,appointment_start,appointment_end,google_eventid ) values (" & _
                        gl_engid & ",'" & _
                        entr.Title.Text & "','" & _
                        entr.Content.Content.ToString & "','" & _
                        "Day Appointment" & "','" & _
                        Format(entr.Times.Item(0).StartTime, "yyyy-M-d H:mm:ss") & "','" & _
                        Format(entr.Times.Item(0).EndTime, "yyyy-M-d H:mm:ss") & "','" & _
                        eventid & "')"


                    mysql_query_nr(strsql)
                End If

                ' MsgBox(entr.Content.Content.ToString)
                '  entr.Title.Text  has the title of the calendar event
                ' entr.Times.item(0).StartTime has the starting time of the event
                '  entr.times.item(0).EndTime has the ending time of the event
                ' entr.Content.Content.ToString has the long description of the event
            Next

        End If
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900