Reputation: 12824
I need to be able to offer "downloadable" events for Outlook, via vCalendar objects - if I'm not mistaken.
From the research I've done, I've been pointed at using vObject. I've looked at their usage examples, but having no prior experience with the format, it's not clear to me how to solve my problem, as I'm not sure what fields are available, or what they're called...
Is there a straighforward example of creating an very simple object/vCalendar event with some type of name/description, that has a start and end time/date?
I'll be using Django, and will probably just dynamically create these for "download" as requested.
Upvotes: 2
Views: 2212
Reputation: 51
I was having the same issue on a Windows system. Once I replace crlfs with lfs things started working for me.
output = cal.serialize().replace(u'\r\n', u'\n' ).strip()
Upvotes: 1
Reputation: 11
Outlook 2003 seems to need a UID field for every VEVENT. the icalendar module doesn't seem to use these, so I've had to add the following snippets of code:
import uuid
...
event.add('uid',uuid.uuid4())
Upvotes: 1
Reputation: 49236
I believe the most useful fields are:
dtstart
: start timedtend
: end timesummary
location
url
description
Then you create a calendar with:
cal = vobject.iCalendar()
then an event:
event = cal.add('vevent')
and populate it:
event.add('summary').value = 'your summary'
event.add('dtstart').value = datetime.now() # or anything else
...
Now if you want to return the calendar via http, you can use cal.serialize()
.
Upvotes: 2