GoogleCalendar.cfc Version 1
I've updated my GoogleCalendar.cfc. It now correctly (I think) handles time zone offsets and recurrences. I also added a simple way to make it refresh its own cache.
I think next I'll make a few convenience functions, like getTodaysEvents, getThisMonthsEvents, getThisWeeksEvents. Suggestions are welcome. (And if you use it on your site, let me know!)
The download is attached to this entry. I'll add a project page later on.
Oh - and I actually included instructions this time, and, thanks to certain events in the past, a license file as well.

hah.
jk, really.
"SyncKolab was written to add kolab functionality to thunderbird. It reads a selected Imap folder and synchronizes it with the local address book and calendar."
http://www.gargan.org/extensions/synckolab.html
Thanks for the great start. I saw the Google calendar a couple of days ago and it about blew my mind. I have a customer that is trying to implement a scheduling calendar. The have been asking about dragging the appointments to different days in the calendar. That would require updating the database with the new date. Do you see a way in the Google API that when an event is moved or dropped to fire an event to a remote server to accomplish this?
Thanx
Jeff Douglas
<cfset modifiedContent = Replace(r.content, '\n' , '#chr(10)#', 'all')>
seemed to work. i just didnt know what chr i was to replace...i thought it was \n or \r
also can i edit my comments so i dont have to send a new one everytime i think of something new
Using a ColdFusion QoQ to sort on a field named "date" will throw an error.
Is there a way to rename an existing query fieldname?
What a great tool. Thanks so much!
Please excuse my ignorance, I have not used cfc's at all. I can get the dump to work well from my calendar. But I am having trouble outputting a query onto my page. What code would I use to out put this.
eg
<cfoutput query="r">#author#</cfoutput> or
<cfoutput query="application.gCal.readEntries()">#author#</cfoutput>
I am sorry this is probably way basic and if I could get a nudge in the right direction I would be greatful.
Thanks
Lach
Dylan
UCSD School of Medicine
For those who want to see a real example, click on the Speaking Engagement tab above.
Thanks
http://ray.camdenfamily.com/index.cfm?mode=entry&a...
To be clear - this is an OLD project of mine. It isn't even listed on my projects page yet.
ray.camdenfamily.com/downloads/ical.zip
I saw your gCal application and downloaded it but when i try browsing it, i get this error message "An error occured while Parsing an XML document.
Content is not allowed in prolog." it has something to do with parsing to XML in the file GoogleCalendar.cfc. Anyone experiencing the same thing?
The XML comes from Google itself. Basically my CFC grabs the XML feed and parses it.
http://ray.camdenfamily.com/projects/googlecal/
Attribute validation error for tag http.
The tag does not have an attribute called result. The valid attribute(s) are url, port, method, username, password, name, columns, charset, path, file, delimiter, textqualifier, resolveurl, proxyserver, proxyport, proxyUser, proxyPassword, useragent, throwonerror, redirect, firstRowAsHeaders, timeout, multipart, getAsBinary.
What am I missing?
You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.
The error occurred in C:\Inetpub\wwwroot\NewSite\GoogleCalendar.cfc: line 184
Called from C:\Inetpub\wwwroot\NewSite\GoogleCalendar.cfc: line 19
Called from C:\Inetpub\wwwroot\NewSite\calendartest.cfm: line 3
182 : <cfhttp url="#variables.calendarURL#">
183 : <!--- translate to xml --->
184 : <cfset variables.calendarXML = xmlParse(results.fileContent)>
185 :
186 : </cffunction>
My test page reads like this:
<cfapplication name="gCal">
<cfset reload = false>
<cfif not structKeyExists(application, "gCal") or reload>
<cfset application.gCal = createObject("component", "GoogleCalendar").init("http://www.google.com/calendar/feeds/rollisoj@gmai...)>
</cfif>
<cfset r = application.gCal.readEntries()>
<cfdump var="#r#">
<cfset m = application.gCal.readMeta()>
<cfdump var="#m#">
Does this require a partcular version of Cold Fusion MX? We are using MX 6.1.
Thanks!
Thanks
query - Top 0 of 0 Rows
struct
SUBTITLE Jay xxxxx
TITLE Jay xxxxx
I have events scheduled on the calendar but they are not being pulled in. How do I show the data returned from the readEntries query specified in the testa.cfm?
Thanks for all the help.
One last thing...I have time offset in the testa.cfm set to -5(EST) but the time is still showing 1-hour behind what my Google Calendar shows. Any ideas?
http://ray.camdenfamily.com/projects/googlecal
A new version was released this morning.
Sorry about that. :)
Why is it that no matter what I put in the calender url var on the testa page, it returns the Holidays calendar? It is obviously a cache issue, but I don't know how to fix it
Thanks
Russ
Yea I couldn't remember which post I commented on, and I have a new spam filter that I haven't got control of yet, so I didn't get any reply responce...sorry:[
I did figure out the reinit variable and of course it works great!
thanks,
I will have to have a look at that wish list, I am sure I can work the costs into my next project..
Local variable results on line 179 must be grouped at the top of the function body.
The error occurred in C:\Inetpub\wwwroot\Application.cfm: line 16
14 :
15 : <cfif not structKeyExists(application, "gCal") or structKeyExists(url, "reinit")>
16 : <cfset application.gCal = createObject("component", "GoogleCalendar").init(calendar,-4)>
17 : </cfif>
18 :
Any ideas as to why this would start occuring after a simple Windows update?
Thanks
<cfset u = application.gCal.update()>
Shouldn't this be refreshing the cache?
thx!
The request has exceeded the allowable time limit Tag: cfhttp
The error occurred in C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc: line 181
Called from C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc: line 19
Called from C:\CFusionMX7\wwwroot\ows\Calendar\testa.cfm: line 5
179 :
180 : <!--- download xml --->
181 : <cfhttp url="#variables.calendarURL#" result="results">
182 : <!--- translate to xml --->
183 : <cfset variables.calendarXML = xmlParse(results.fileContent)>
--------------------------------------------------------------------------------
Resources:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
Remote Address 127.0.0.1
Referrer
Date/Time 29-Jun-07 12:22 PM
Stack Trace (click to expand)
at cfGoogleCalendar2ecfc117159695$funcLOAD.runFunction(C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc:181) at cfGoogleCalendar2ecfc117159695$funcINIT.runFunction(C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc:19) at cftesta2ecfm1528332162.runPage(C:\CFusionMX7\wwwroot\ows\Calendar\testa.cfm:5)
coldfusion.runtime.RequestTimedOutException: The request has exceeded the allowable time limit Tag: cfhttp
at coldfusion.tagext.net.HttpTag.checkTimeout(HttpTag.java:1905)
at coldfusion.tagext.net.HttpTag.doEndTag(HttpTag.java:1005)
at coldfusion.runtime.CfJspPage._emptyTag(CfJspPage.java:1916)
at cfGoogleCalendar2ecfc117159695$funcLOAD.runFunction(C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc:181)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:290)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:254)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:56)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:1807)
at cfGoogleCalendar2ecfc117159695$funcINIT.runFunction(C:\CFusionMX7\wwwroot\ows\Calendar\GoogleCalendar.cfc:19)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:290)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:254)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:56)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:194)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:146)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:1634)
at cftesta2ecfm1528332162.runPage(C:\CFusionMX7\wwwroot\ows\Calendar\testa.cfm:5)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:225)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115)
at coldfusion.CfmServlet.service(CfmServlet.java:107)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:318)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:264)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
An error occured while Parsing an XML document.
Content is not allowed in prolog.
The error occurred in C:\Inetpub\wwwroot\_Gcal\GoogleCalendar.cfc: line 183
Called from C:\Inetpub\wwwroot\_Gcal\GoogleCalendar.cfc: line 19
Called from C:\Inetpub\wwwroot\_Gcal\testa.cfm: line 5
181 : <cfhttp url="#variables.calendarURL#" result="results">
182 : <!--- translate to xml --->
183 : <cfset variables.calendarXML = xmlParse(results.fileContent)>
184 :
185 : </cffunction>
But, that brings up the question, is there a way to identify myself to Google in the request so that the calendar can remain private and yet I can get my own results via your cfc?
I am continuing to work to add Creation of reoccuring events and possibly, create to a secondary calendar. I will send you my complete version of the GoogleCalendar.cfc when I get reoccuring done for your critique.
Error Executing Database Query.
Query Of Queries runtime error.
The select column reference [starttime] is not a column in any of the tables of the FROM table list.
The error occurred in C:\CFusionMX7\CustomTags\GoogleCalendar.cfc: line 580
Called from C:\Apache2\htdocs\dev\gcal.cfm: line 14
Called from C:\CFusionMX7\CustomTags\GoogleCalendar.cfc: line 580
Called from C:\Apache2\htdocs\dev\gcal.cfm: line 14
578 : select *
579 : from q
580 : where starttime > <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
581 : </cfquery>
582 : </cfif>
Any ideas here? We're running CF 7
Thanks!
http://googlecal.riaforge.org/
I'm assuming that is my problem... When I run on CF MX I get the error:
Local variable colNames on line 41 must be grouped at the top of the function body.
Will this only run on certain versions of coldfusion???
http://googlecal.riaforge.org/
It requires CF7.
The method 'getCalendars' could not be found in component D:\casemed_web\newhome\GoogleCalendar.cfc.
Check to ensure that the method is defined, and that it is spelled correctly.
<cffunction name="getCalendars" access="public" returnType="query" output="false" hint="Returns all the calendars for the user.">
Did you maybe typo the call? getCalenders?
the recurring string thats returned seems very difficult to parse, in the google api docs it says about using a getTimes() function but i can't figure out how i would use it.
I managed to get it to show a date in the date field by changing the following line
In the parseRecurrenceDate function in GoogleCalendar.cfc
I changed
<cfset datestring = reFindNoCase("DTSTART;VALUE=DATE:([0-9]+)", arguments.recurrence,1,true)>
to
<cfset datestring = reFindNoCase("DTSTART;TZID=Europe/London:([0-9]+)", arguments.recurrence,1,true)>
BUT this obviously wont work if your timezone isnt europe/London
If anyone has a cleaner nicer solution or i am doing something silly please let me know.
It really is difficult to get this working actually because this type of event i need the time as well and when it does the parseRecurrenceDate function there is no time information and this is a recurring event that happens between 7pm and 9pm which i'll need to display.
The bit where you do this parsing it hurting my head i'm wondering if i can get the start time and end time in the output somehow for recurring events.
<cfoutput>
<cfhttp url="#variables.calendarURL#" method="GET">
</cfoutput>
<!--- translate to xml --->
<cfset variables.calendarXML = xmlParse(cfhttp.fileContent)>
<cfhttp url="#curl#" result="result">
<cfhttpparam type="header" name="Authorization" value="GoogleLogin auth=#variables.authcode#">
</cfhttp>
I get an xml error because the cfhttp retrieves the 302 redirect html rather than the feed.
I don't think this is anything to do with your api though. Would be greatful if you have any ideas on how I can workaround this
I had to create the feed on a cf8 server and read that instead so that railo didnt see the redirect that happens on the google calendar api.
the google api does a redirect before the data is returned
"Content is not allowed in prolog. The error occurred in C:\...\GoogleCalendar.cfc: line 427"
I modified 'calendar' to my own 'private' string, and set my username and password in application.gCal = createObject
Thoughts?
I've run into the same error on my dev machine and on our live server. I'll see if I can get another dev machine to throw it as well.
Am I correct in assuming that this cfc would need changing to work with OAuth2 (as per your post http://www.raymondcamden.com/index.cfm/2011/12/6/W...)?
If so, is anyone doing that (before I reinvent the wheel!)
Thanks,
Murray
I'm going to release this - but not this week. Please remind me (and if you need it _right now_, email me).
And thanks for your oauth post - it helped greatly to get my head around the 'dance'.
Best wishes,
Murray
http://www.raymondcamden.com/enclosures/v2.zip
How can I get more than 25 results back from google?
Thanks!
http://googlecal.riaforge.org/
The one linked to above was the beginning of a new version using Google's very latest API. I do not support it, but it is there if you would like.
The version at RIAForge supports maxevents. Google defaults to 25, but you can ask for up to 100 I believe.
Thanks for your useful code and continuous help to ColdFusion community. Ray, Google has released V3 and all we are waiting for your update on Google Calender. Hope soon we will see this.
Thanks
Best wishes,
Iftkhar