Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
469 views
in Technique[技术] by (71.8m points)

Grouping multiple events in a single ics file (icalendar stream)

I want to group multiple events in a single ICS file(iCalendar stream) according to the RFC. This can be done but I have no idea how. Can anyone help me or give me an example ?

Here is what rfc says:

However, multiple iCalendar objects can be sequentially grouped
together in an iCalendar stream. The first line and last line of the iCalendar object MUST contain a pair of iCalendar object delimiter
strings. The syntax for an iCalendar stream is as follows:

 icalstream = 1*icalobject

 icalobject = "BEGIN" ":" "VCALENDAR" CRLF
              icalbody
              "END" ":" "VCALENDAR" CRLF
question from:https://stackoverflow.com/questions/1823647/grouping-multiple-events-in-a-single-ics-file-icalendar-stream

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

here is a simple example of an icalendar file with two events.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//bobbin v0.1//NONSGML iCal Writer//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART:20100701T080000Z
DTEND:20100701T110000Z
DTSTAMP:20091130T213238Z
UID:[email protected]
CREATED:20091130T213238Z
DESCRIPTION:Example event 1
LAST-MODIFIED:20091130T213238Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Example event 1
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART:20100701T120000Z
DTEND:20100701T130000Z
DTSTAMP:20091130T213238Z
UID:[email protected]
CREATED:20091130T213238Z
DESCRIPTION:Example event 2
LAST-MODIFIED:20091130T213238Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Example event 2
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

Copy this into a file and save it as events.ics and it should open in most icalendar compatible applications e.g. Outlook 2007, Sunbird, iCal. For more complicated examples you could try creating events in Google calendars and exporting the calendars to view the results or downloading preexisting calendars from somewhere like icalshare.com. The file format is similar to e-mail encoding in that it must be folded. Wikipedia has a pretty good article on ICalendar and if you Google "icalendar validator" you there are several services that will let you validate your files. Oh and if you get frustrated with it, you're not alone http://www.google.co.uk/support/forum/p/Calendar/thread?tid=366b19a87d1304ec&hl=en although it is a good spec imho, its implementations are very, er, different.

A little more detail on how you want to use it would help others help you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...