Skip to content

Working with non standard (X prefixed) properties

Rian Stockbower edited this page Nov 24, 2017 · 4 revisions

RFC-5545 allows for non-standard properties, prefixed with a X-. Outlook, Google Calendar, and many other calendar applications make use of these non-standard properties for their own purposes. ical.net makes no attempt to support all of them, because they can be literally anything.

Add a non-standard property to a CalendarEvent

var now = DateTime.Now;
var calendarEvent = new CalendarEvent
{
    Start = new CalDateTime(now),
    End = new CalDateTime(now.AddHours(1)),
    Properties =
    {
        new CalendarProperty("X-RESPONSE-COMMENT", "Some value")
    },
};

Retrieve a specific non-standard property from a CalendarEvent

This will return the name-value pair that you added above.

var retrievedProperty = calendarEvent.Properties
    .FirstOrDefault(p => p.Name.Equals("X-RESPONSE-COMMENT"));