Google Calendar/Contacts update

This post is more than 2 years old.

I updated both my GoogleCal and GoogleContacts projects tonight. GoogleCal was updated to use the new base CFC code GoogleContacts uses. I also added basic support for some of the API methods for getting events that Google supports. Both projects now support hosted Google accounts as well.

I'm considering maybe merging these two projects into one uber project, like I did for my cfYahoo package. Any opinions?

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Scott P posted on 9/18/2008 at 7:09 AM

one ring to rule them all

Comment 2 by James Edmunds posted on 9/18/2008 at 6:03 PM

I like them separate, actually, since I am interested only in the calendar portion. You know, basing my thoughts on what is good for all of humanity by the yardstick of my own very personal needs ;).

Comment 3 by Bret posted on 7/7/2009 at 8:56 PM

this is a great piece, thanks for writing it and posting it!

i did run into a problem, though, that i wanted to post about in case it will help someone else. i noticed that there is a difference in default charsets between CF7 and CF8. this was causing me to get a weird prolog error on CF7 servers (tested on two to confirm), because it was coming back empty. i tested a bit of urlencoding and a snippet from ben nadel's site (he ran into a similar prolog error), and still was getting an error. then i finally realized i needed to specifiy the charset="utf-8" on the cfhttp because the server versions were different. once i did this, everything worked on both CF7 and CF8. seems so small, but took me a few hours to figure out. oh well, i am now on my way to ninja cf status for having spent time to figure it out.

thanks again.

Comment 4 by Armando Musto posted on 1/22/2012 at 3:02 AM

I've used a number of your tips and tools over the year, the googleCalendar CFC is great.
It really offered great insight.

Thank you

Comment 5 by Raymond Camden posted on 1/22/2012 at 8:43 PM

Glad to help, Armando.

Comment 6 by Jeremy Witherell posted on 2/7/2013 at 9:28 AM

I love this CFC! I'm very excited to implement this so I can control the way my calendars are displayed. Being new to CF, I'm having a slight problem applying this to my site, so any help would be appreciated. The issue I'm having is I have four different calendars (5 including the US Holidays calendar) that I need to incorporate in different combinations in different places on my site. My site is for my band program's three competitive ensembles, so each of them has its' own independent calendar, and then there's a separate calendar for events that apply to all three groups. Basically, I set this up so that one group's calendar wouldn't be cluttered up by another group's rehearsals and such, but I also wouldn't have to enter events that apply to all the groups three times for their three calendars. Google makes it easy to display multiple calendars together in the iframe, but obviously customizing the CSS is impossible.

What I've tried is running the GoogleCalendar CFC for each of my calendars, and then using Q of Q with UNION to combine them into one master recordset. This yields the following error:

Query Of Queries runtime error.
All resulting columns of queries in a SELECT statement that contains a UNION operator must have corresponding types.
Columns with index number equal 1 have diffent types (DATE, VARCHAR).

As near as I can tell, the issue is that some of the Date values are empty strings, and that, understandably, is fouling things up. Is there another way to combine these multiple recordsets to work around this error?

Comment 7 by Raymond Camden posted on 2/7/2013 at 8:21 PM

It isn't as sexy, but, build a new query by hand (queryNew), loop over each of the queries and manually add the records one by one. Not sexy, but shouldn't be terribly slow either, but you probably want to cache the results.

Although.... how in the heck do you have a calendar entry where the date is empty??

Comment 8 by Jeremy Witherell posted on 2/7/2013 at 9:37 PM

From the looks of it, the way Google codes full-day events, the StartTime and EndTime are both set to just the date (e.g. 2013-02-07), and the Date field is blank. Events with set times have timestamps as the values in all three fields, though. My original thought was that the all-day events were being saved as varchar data types since there's no specified time, and the scheduled events as timestamps, but since the error specifically called out the Date column, that doesn't seem to be the (only?) problem. It doesn't look like any of the Date fields have date-only values, they're all either empty strings or timestamps.

Seems like a strange way to do it to me, but whatever. I'll try your idea. Thanks a million!

Comment 9 by Jeremy Witherell posted on 2/7/2013 at 9:45 PM

My goal is that once I get the display set up the way I want it, I'll use your code to add events directly on my site, and then I can tell Google what to put in those fields. Unfortunately, everything that's been entered through Google's interface is a little screwy at the moment!

Comment 10 by Raymond Camden posted on 2/13/2013 at 5:53 PM

Jeremy - a bit late here - but it sounds like maybe then this is a bug with my CFC. Like it isn't reading those events right. Agreed?