A small library for creating and formatting iCalendar (RFC 5545 / RFC 2445) calendar objects (events, alarms, attendees, organizers, etc.).
- Build iCalendar objects (VCALENDAR, VEVENT, VALARM...)
- Escape and format values for iCalendar compatibility
- Support for timezone-aware date/time using
DateTimeOffset
This repository contains projects targeting multiple frameworks. The library is compatible with:
- .NET Standard 2.0
- .NET Standard 2.1
- .NET 6
- .NET 8
- .NET 10
Prerequisites: installed .NET SDK (recommended: .NET 8).
To restore and build:
dotnet restore
dotnet build -c ReleaseTo create NuGet packages:
dotnet pack -c Release -o ./artifactsUse the library to construct calendar objects and get the iCalendar text or stream:
var calendar = new MeetingRequest.Calendar
{
ProdID = "MyCompany//MyApp//EN",
Version = "2.0",
CalendarMethod = MeetingRequest.CalendarMethod.REQUEST
};
// add events/attendees/alarms...
string icalText = calendar.GetCalendarContentText();
using var stream = calendar.GetCalendarContentStream();- Date/time fields use
DateTimeOffsetto preserve timezone/offset information. - Strings are escaped for iCalendar compliance by the library, but callers should validate required fields (e.g.
UID,Email). - Consider adding unit tests and enabling nullable reference types for improved safety.
This project is licensed under the MIT License. See the LICENSE file for details.