-iCalendar .NET library
A .Net iCalendar library used to parse,create, manipulate, databind and export iCalendar data in various
formats.
For a list of all members of this type, see Calendar Members.
System.Object
Calendar
Overview
The iCalendar library is designed to allow developers to create new file or parse an iCalendar (.ics) file and
expose the parsed data via the iCalendar rich object model. It also alows for the iCalendar
object to be persisted as a new iCalenar (.ics) file, xCal - XML iCalendar format, Resource Description Framework
(RDF) - .rdf format.
The library is built 100% in .NET managed code(C#). The iCalendar object model is based on the formal
iCalendar Specification, RFC 2445, from the Internet Engineering Task Force.
The iCalendar object design and implementation follows very closely the
iCalendar UML specification done by
Michael Arick at the Baskin School of Engineering,
University of California.
Feature List
using ZsoftNet.iCalendar;
...
ZsoftNet.iCalendar.Calendar oCalendar;
CalendarParser oParser = new CalendarParser();
oCalendar = oCalParser.Parse("C:\CalFiles\Jan-Meetings.ics");
using ZsoftNet.iCalendar;
...
ZsoftNet.iCalendar.Calendar oCalendar;
CalendarParser oParser = new CalendarParser();
oCalendar = oCalParser.Parse("http://www.yourdomain.com/calendars/Events.ics");
using ZsoftNet.iCalendar;
...
ZsoftNet.iCalendar.Calendar oCalendar;
CalendarParser oParser = new CalendarParser();
//Should return data like "BEGIN:VCALENDAR BEGIN:VEVENT... END:VEVENT END:VCALENDAR"
String calData = GetCalendarData();
oCalendar = oCalParser.Parse(calData);
using ZsoftNet.iCalendar;
using ZsoftNet.iCalendar.Components;
...
ZsoftNet.iCalendar.Calendar oCalendar;
//This assumes you build a valid Calendar object
//Declare a VEvent object
VEvent calEvent;
//Find the event with UID="1122DFG"
calEvent = oCalendar.Events.FindEventByUID("1122DFG");
if (calEvent != null)
{
//Show the Event contents
txtSummary.Text = calEvent.Summary.Value;
txtStartDate.Text = calEvent.DateTimeStart.DateTime;
and so on...
}
using ZsoftNet.iCalendar;
using ZsoftNet.iCalendar.Components;
...
ZsoftNet.iCalendar.Calendar oCalendar;
//This assumes you build a valid Calendar object
//Declare a VEvent object
VEvent calEvent;
//Find the event with UID="1122DFG"
calEvent = oCalendar.Events.FindEventByUID("1122DFG");
if (calEvent != null)
{
//Update the Event contents
calEvent.Summary.Value = "This is just the summary for event.";
calEvent.DateTimeStart.DateTime = DateTime.Now; //Set today
and so on...
}
//Finally save the new updated Calendar.
using ZsoftNet.iCalendar;
using ZsoftNet.iCalendar.Components;
...
ZsoftNet.iCalendar.Calendar oCalendar;
CalendarParser oParser = new CalendarParser();
oCalendar = oCalParser.Parse("C:\CalFiles\Jan-Meetings.ics");
//Validate that all the Properties and Components according to the
//iCalendar specification requirements for properties and parameters
oCalendar.Validate();
//You can validate only the components
foreach(ZsoftNet.iCalendar.Component c in oCalendar.Components)
{
c.Validate();
}
//After calling ToBindable(), you can Validate only certain types of Components
oCalendar.ToBindable();
//Validate Events only
foreach(ZsoftNet.iCalendar.Components.VEvent ev in oCalendar.Events)
{
ev.Validate();
}
using ZsoftNet.iCalendar;
...
ZsoftNet.iCalendar.Calendar oCalendar;
//Once calendar object is created, modifications are made to the data
//Persist the new updated object to a new file.
CalendarWriter calWriter = new CalendarWriter();
//Persist as iCalendar file ( .ics)
calWriter.Write(oCalendar,"C:\CalFiles\MyEvents.ics");
.
using ZsoftNet.iCalendar;
...
ZsoftNet.iCalendar.Calendar oCalendar;
//Once calendar object is created, modifications are made to the data
//Persist the new updated object to a new file.
CalendarWriter calWriter = new CalendarWriter();
//Persist as xCal - XML iCalendar file ( .xml)
calWriter.WriteXML(oCalendar,"C:\CalFiles\MyEvents.xml");
using ZsoftNet.iCalendar;
...
ZsoftNet.iCalendar.Calendar oCalendar;
//Once calendar object is created, modifications are made to the data
//Persist the new updated object to a new file.
CalendarWriter calWriter = new CalendarWriter();
//Persist as RDF file ( .rdf)
calWriter.WriteRDF(oCalendar,"C:\CalFiles\MyEvents.rdf");
using ZsoftNet.iCalendar;
...
ZsoftNet.iCalendar.Calendar oCalendar;
CalendarParser oParser = new CalendarParser();
oCalendar = oCalParser.Parse("C:\CalFiles\Meetings.ics");
//Call the ToBindable() method to expose the properties for each object
//Read the notes on the ToBindable method for more details
oCalendar.ToBindable();
//Now the object is ready to provide data for databinding...
//Bind all the Events to a datagrid
//Here is a sample DataGrid databinding syntax for VEvent properties.
//
// DataBinder.Eval(Container, "DataItem.UniqueIdentifier.Value")
// DataBinder.Eval(Container, "DataItem.DateTimeStart.DateTime")
//
dgEvents.DataSource = oCalendar.Events;
dgEvents.DataBind();
//Bind all the ToDo's to a datagrid
dgToDo.DataSource = oCalendar.ToDos;
dgToDo.DataBind();
//Bind all the Journals to a datagrid
dgJournals.DataSource = oCalendar.Journals;
dgJournals.DataBind();

using ZsoftNet.iCalendar;
...
ZsoftNet.iCalendar.Recurrence oRecurrence;
//Create Recurrence Instance from the RRULE input
//"RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=1SU;"
oRecurrence = new Recurrence("FREQ=MONTHLY;INTERVAL=1;BYDAY=1SU;");
DateTimeCollection recurrenceDates;
DateTime startDate = DateTime.Now;
//For items that repeat forever, specify the max number of dates to generate.
//This is ONLY applicable for RRules that do not have Count, or DateUntil specified
//like the example above.
int totalDatesToGenerate = 20;
//Call the static method to generate the dates for this RRULE.
//The list will have 20 dates, The Last Sunday of the Month from today for the next 20 months.
recurrenceDates = Recurrence.GenerateRecurrenceDates(oRecurrence,startDate,totalDatesToGenerate);
Namespace: ZsoftNet.iCalendar
Assembly: ZsoftNet.iCalendar.1.0 (in ZsoftNet.iCalendar.1.0.dll)
Calendar Members | ZsoftNet.iCalendar Namespace