Skip to content

How to create a simple calendar event #603

Answered by axunonb
aguyfromdenmark asked this question in Q&A
Discussion options

You must be logged in to vote

Here is the corrected code.
If you set the CalendarEvent.Name it MUST be RFC 5545 compliant.

var date = new CalDateTime(2024, 10, 15, 11, 0, 0);
var calendarEvent = new CalendarEvent
{
    // If Name property is used, it MUST be RFC 5545 compliant
    Summary = "Event Title", // Should always be present
    Description = "Event description goes here", // optional
    Start = new CalDateTime(date),
    End = new CalDateTime(date.AddHours(2)),
};

var calendar = new Ical.Net.Calendar();
calendar.Events.Add(calendarEvent);
calendar.AddTimeZone(new VTimeZone("Europe/Copenhagen")); // TZ should be added
var serializer = new CalendarSerializer();
var serializedCalendar = serializer.SerializeToS…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@aguyfromdenmark
Comment options

@axunonb
Comment options

Answer selected by aguyfromdenmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #597 on October 15, 2024 08:33.