CalDAVNet is a project to access CalDAV servers and a fork of https://github.com/markatk/CalDAV.NET.
- Net 8.0
- Net 9.0
using Ical.Net.CalendarComponents;
/// <summary>
/// The main method.
/// </summary>
public static async Task Main()
{
// Create client.
var calDavClient = new Client("http://192.168.2.2/caldav.php/user/someid", "user", "password");
// Get all calendars for the user.
var calendars = await calDavClient.GetAllCalendars();
// Get the calendar by the uid.
var calendarByUid = await calDavClient.GetCalendarByUid("/caldav.php/user/uniqueid/");
// Get the default calendar.
var defaultCalendar = await calDavClient.GetDefaultCalendar();
// Add an event.
var calendarEvent = new CalendarEvent();
var added = await calDavClient.AddOrUpdateEvent(calendarEvent, new Ical.Net.Calendar());
// Delete an event.
var deleted = await calDavClient.DeleteEvent(calendarEvent);
}
The project can be found on nuget.
dotnet add package HaemmerElectronics.SeppPenner.CalDAVNet
See the Changelog.