Announcement

Collapse
No announcement yet.

Google Calendar Interface

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Google Calendar Interface

    Does anyone have an example of retrieving google calendar events so that I can complete my speak events script.

    I used (many years ago) to be a programmer - but some of these api's leave me cold!

    Any help appreciated.

    #2
    There is a plugin that has been written by HS themselves for Google Calendar, not sure if its finished or not (think it had some minor issues) but it is about somewhere with the sourcecode if you want to try and fix it.

    Comment


      #3
      That would be brilliant. Any idea where I may find it?

      Comment


        #4
        Here it is http://forums.homeseer.com/showthrea...light=calendar in this thread somewhere...

        Comment


          #5
          Amazing - thanks. Seems it was me who raised it before - just shows I'm getting old.

          Thanks

          Comment


            #6
            If that did'nt work then it does look like they support RSS feeds, so you should I think be able to read these feeds into HS relatively easily with a simple script that parsed XML data if that is what you were after or the plugin did not work.

            Comment


              #7
              I use the API to delete old events, so the code should be easily modified to extract details of each event, as the code below retrieves a list of events in the last 7 days:

              Dim myService As Google.GData.Calendar.CalendarService = New CalendarService("Johnny")

              myService.setUserCredentials("YourUserName", "YourPassword")

              Dim myQuery As New EventQuery("http://www.google.com/calendar/feeds/<YourUsername>/private/full")


              myQuery.EndTime = Now.Date()
              myQuery.StartTime = DateAdd(DateInterval.Day, -7, myQuery.EndTime)

              Dim myResultsFeed As EventFeed = myService.Query(myQuery)


              '// Create an batch entry to delete an existing event.


              Dim batchFeed As New AtomFeed(myResultsFeed)

              '// Add the entries to a new feed.
              For Each entry As EventEntry In myResultsFeed.Entries
              Dim toDelete As EventEntry = DirectCast(entry, EventEntry)

              toDelete.Id = New AtomId(toDelete.EditUri.ToString())
              toDelete.BatchData = New GDataBatchEntryData("C", GDataBatchOperationType.delete)
              ' Add to batch
              batchFeed.Entries.Add(toDelete)
              deleteCount = deleteCount + 1
              Next
              hs.WriteLog("GoogleCalDelete", "Deleting " & deleteCount & " events")

              Dim batchResultFeed As EventFeed = DirectCast(myService.Batch(batchFeed, New Uri(myResultsFeed.Batch)), EventFeed)


              'check the return values of the batch operations to make sure they all worked.
              'the delete operation should return 200
              Dim success As Boolean = True
              For Each entry As EventEntry In batchResultFeed.Entries
              If entry.BatchData.Status.Code <> 200 Then
              success = False
              hs.WriteLog("GoogleCalDelete", "The batch delete operation failed.")
              End If
              Next

              Regards,
              John

              Comment


                #8
                Thanks

                Thanks Jimbob - I'll give it a go..

                Comment


                  #9
                  Was any progress made with this? I'd be interested in working this into my installation as well!

                  Comment


                    #10
                    Struggling with the reference to google.data stuff.
                    D/l the Google Data API but still getting following error.

                    Script compile error: Type 'Google.GData.Calendar.CalendarService' is not defined

                    Any idea how to troubleshoot this?
                    Don

                    Comment


                      #11
                      Originally posted by donstephens View Post
                      Struggling with the reference to google.data stuff.
                      D/l the Google Data API but still getting following error.

                      Script compile error: Type 'Google.GData.Calendar.CalendarService' is not defined

                      Any idea how to troubleshoot this?
                      Have you added the appropriate entries to the ScriptingReferences section of the settings.ini file e.g. I currently have Google.GData.Calendar;Google.GData.Calendar.dll,Google.GData .Client;Google.GData.Client.dll,Google.GData.Extensions;Goog le.GData.Extensions.dll,Google.GData.AccessControl;Google.GD ata.AccessControl.dll

                      Not sure if they are all needed but certainly the first one...

                      John

                      Comment


                        #12
                        <sheepish grin> Oh, no, I didn't.
                        Thanks, I'll give it a try.

                        Wow! Is all that on ONE line?

                        Originally posted by JimBob View Post
                        Have you added the appropriate entries to the ScriptingReferences section of the settings.ini file e.g. I currently have Google.GData.Calendar;Google.GData.Calendar.dll,Google.GData .Client;Google.GData.Client.dll,Google.GData.Extensions;Goog le.GData.Extensions.dll,Google.GData.AccessControl;Google.GD ata.AccessControl.dll

                        Not sure if they are all needed but certainly the first one...

                        John
                        Last edited by donstephens; May 14, 2012, 01:17 PM.
                        Don

                        Comment


                          #13
                          Yep, add it to any existing entry you have there.
                          The paste seems to have got corrupt in my post - there is no gap between "GD" and "ata" near the end. weird.

                          Edit:
                          And no gap between "GData" and ".Client"

                          Comment


                            #14
                            Where did you put the google dlls and where did you find them? I d/l the Google_Data_API_setup2.0.1.0 and when it ran the DLLs went into a directory in the Program Files/Google.
                            Don

                            Comment


                              #15
                              Looks like I am a little out of date! I am still using v1.6.
                              On my installation all the dlls were installed to a "redist" subdirectory where the API installed to.

                              I manually copied the following dlls to the HomeSeer home directory:
                              Google.GData.AccessControl
                              Google.GData.Calendar
                              Google.GData.Client
                              Google.GData.Extensions

                              Comment

                              Working...
                              X