I've been using the iPhone for a couple of months now and one thing that kept bugging me was that iTunes does not allow you to specify a server based calendar as the calendar to sync events created on the iPhone to. It only allows to sync events created on the iPhone to local calendars in iCal. Since I'm using Zimbra as my server for mail, calendar, etc. and I want to be able to update it also when I'm not near my MacBook Pro that becomes pretty annoying. In OS X Leopards iCal you can subscribe to server based calendar and also update them, so it's a mistery to my why the iPhone events can't be synced to a CalDAV server.
Anyways, a nice challenge to solve and it's actually pretty easy using Applescript. I've set up iCal to subscribe to the CalDAV server. So from iCal (and the Zimbra web client) I'm working on the same data. Then there an iCal local calendar defined (named iPhone) and in iTunes this calendar is specified as the one where new events created on the iPhone should be stored. The server based Calendar that iCal is subscribed to is also selected in iTunes to be sync to the iPhone.
So now the only we need to accomplish is get the events created on the iPhone into the CalDAV server. The following Applescript does this for me:
tell application "iCal"
set allEvents to every event in calendar "iPhone"
repeat with theEvent in allEvents
make new event at end of events of calendar "Calendar"
with data theEvent
This script is scheduled to run eveny 15 minutes and simply copies all events found in the iPhone calendar to the server Calendar and then removes it from the iPhone. Works nicely and the only drawback left is that events are not sync-ed in realtime, I have to do a sync between the MacBook and the iPhone... but who knows, maybe that can be improved using the push capabilities that are part of iPhone 2.0.