How to publish a dynamic event feed for google calendar?

安稳与你 提交于 2019-12-03 01:13:49
Malcolm Box

Looking at other sites that do this, it would seem that google does re-read external calendars in ical format regularly.

It then's up to you to trim the ical feed you provide e.g by killing dates in the past.

So to solve your problem:

  • generate a ical file and serve from your web site
  • get your users to subscribe to it in Google Calendar
  • regularly refresh the ical file, trimming old data

Example headers & start of ics file from TripIt.com, where this seems to work well:

curl -v http://..../tripit.ics

< HTTP/1.1 200 OK
< Server: nginx
< Date: Fri, 29 Jan 2010 21:53:58 GMT
< Content-Type: text/calendar; charset=utf-8
< Transfer-Encoding: chunked
< Connection: close
< Expires: Fri, 29 Jan 2010 22:08:58 GMT
< Cache-Control: private
< 
BEGIN:VCALENDAR
X-WR-CALNAME:Malcolm Box (TripIt)
X-WR-CALDESC:TripIt Calendar
X-PUBLISHED-TTL:PT15M
PRODID:-//John Papaioannou/NONSGML Bennu 0.1//EN
VERSION:2.0
BEGIN:VEVENT
...

iCal users, at least, can subscribe directly to the ics file. I find iCal shows my updates within 20 minutes or so, and even that delay I'm guessing is because the calendar I'm using (JEvents) only updates the ics file every so often.

Google Calendar is taking hours to show my changes - even if I unsubscribe and create a new subscription to the same URL, I see events that were deleted long ago.

Looks like to reliably update the google calendar you have to use the API: http://code.google.com/apis/calendar/data/2.0/developers_guide.html although I'll bet from a pragmatic point of view, if you have an ical file that updates reasonably often, you will get decent performance.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!