The Importance of Knowing Your Data
I have been developing a custom Google Calendar plugin for a site I am developing and for use in Dot Net Nuke. However for a few hours I have had myself perplexed by the fact that when I was trying to ouput and render the events title, start / end date and location all that was rendered was the title. Initially I though my code was wrong, so I compared it to Thom Shannons PocketGCalSync code, and found that I was doing it right, if only a bit different, I was choosing to loop through the times and locations collections instead of specifying to use just the root. So I was stumped. In work yesterday Chris mentioned if I was sure the data structure was correct. Now at the time I said it was. According to the gData API :
<entry> <id>http://www.google.com/calendar/feeds/jo@gmail.com/private-magicCookie/full/entryID</id> <published>2006-03-30T22:00:00.000Z</published> <updated>2006-03-28T05:47:31.000Z</updated> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'></category> <title type='text'>Lunch with Darcy</title> <content type='text'>Lunch to discuss future plans.</content> <link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=aTJxcnNqbW9tcTJnaTE5cnMybmEwaW04bXMgbWFyY2guam9AZ21haWwuY29t' title='alternate'></link> <link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/jo@gmail.com/private-magicCookie/full/entryID'></link> <author <name>Jo March</name> <email>jo@gmail.com</email> </author> <gd:transparency value='http://schemas.google.com/g/2005#event.opaque'></gd:transparency> <gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'></gd:eventStatus> <gd:comments> <gd:feedLink href='http://www.google.com/calendar/feeds/jo@gmail.com/private-magicCookie/full/entryID/comments/'></gd:feedLink> </gd:comments> <gd:when startTime='2006-03-30T22:00:00.000Z' endTime='2006-03-30T23:00:00.000Z'></gd:when> <gd:where></gd:where> </entry>So I was assuming that the nodes gd:when and gd:where existed in my stream. However this is where I was wrong, what I had failed to spot whas that in the GData API its uses examples showing the basic and full versions of the feed. So i was using my basic feed url not the full one.
Using "basic" returns a basic Atom feed without any extension elements. Using "full" returns a feed that includes all event propertiesStupid I know but now i know, and so do you. So here's to wasting time for not checking the data feed your application is actually using ;) Now this is solved I may be closer to publishing my little addon and see if i can use in in DotNetNuke
2 comments:
I'm curious how the Google calendar / DNN integration project is going... any progress?
sadly due to work commitments no progress as of yet but im hoping to have a good sit down after the bank holiday weekend in the end of May
Post a Comment