/CalDAVNet

CalDAVNet is a project to access CalDAV servers and a fork of https://github.com/markatk/CalDAV.NET.

Primary LanguageC#MIT LicenseMIT

CalDAVNet

CalDAVNet is a project to access CalDAV servers and a fork of https://github.com/markatk/CalDAV.NET.

Build status GitHub issues GitHub forks GitHub stars License: MIT Nuget NuGet Downloads Known Vulnerabilities Gitter

Available for

  • Net 7.0

Net Core and Net Framework latest and LTS versions

Basic usage

using Ical.Net.CalendarComponents;

/// <summary>
/// The main method.
/// </summary>
public static async Task Main()
{
    // Create client.
    //Only works with basic auth
    //Test with baikal => http(s)://server_url:server_port/dav.php/calendars/userucid/
    var calDavClient = new Client("http://localhost:82/dav.php/calendars/user", "user", "pass");
    
    // Get all calendars for the user.
    var calendars = await calDavClient.GetAllCalendars();
    
    // Get the calendar by the uid.
    var calendarByUid = await calDavClient.GetCalendarByUid("default");
    
    // Get the default calendar.
    var defaultCalendar = await calDavClient.GetDefaultCalendar();
    
    // Add an event.
    var calendarEvent = new CalendarEvent()
    {
        Description = "TestDescription1",
        Summary = "TestSummary",
        Location = "TestLocation",
        DtStart = new Ical.Net.DataTypes.CalDateTime(DateTime.Now, "UTC"),
        DtEnd = new Ical.Net.DataTypes.CalDateTime(DateTime.Now.AddHours(2), "UTC"),
    };
    var added = await calDavClient.AddOrUpdateEvent(calendarEvent, "default");
    
    calendarEvent.Summary = "UpdatedSummary";
    var updated = await calDavClient.AddOrUpdateEvent(calendarEvent, "default");
    
    // Delete an event.
    var deleted = await calDavClient.DeleteEvent(calendarEvent, "default");
}

NuGet

The project can be found on nuget.

Install

dotnet add package HaemmerElectronics.SeppPenner.CalDAVNet

Change history

See the Changelog.