Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MySQL VB.NET
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.
 
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 10-Sep-12 19:25pm

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

  Print Answers RSS
0 Maciej Los 450
1 OriginalGriff 393
2 Sergey Alexandrovich Kryukov 229
3 CPallini 189
4 CHill60 180
0 OriginalGriff 6,092
1 Sergey Alexandrovich Kryukov 5,022
2 Maciej Los 3,269
3 Peter Leow 3,164
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 11 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100