Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two-way updatable iCal files in .NET

Tags:

.net

icalendar

I've been trying to create an iCal calendar in .NET that can be synced with other devices. I've been using DDay.iCal to generate iCal events from my data objects, and so far everything's working fine. From Outlook, I've subscribed to the calendar (Add Calendar » From Internet) by pointing to a URL that generates an ics file:

Response.Clear();
Response.ContentType = "text/calendar";
Response.AddHeader("Content-Disposition", "inline; filename=\"Calendar.ics\"");
Response.Write( GenerateCalendar() );
Response.End();

The events are properly imported into the calendar; however, in any Calendar software I've tried, I have been unable to update or delete events. It's not that there is an error in receiving the delete notification; it's simply that all clients recognize the calendar as read-only.

My idea is that by supplying URLs, I would be able to have Outlook or Google calendar contact my server in order to delete an event. Is my entire idea of how this is supposed to work wrong, or am I just missing out on the proper properties? (Or, perhaps, am I importing the calendar incorrectly, or distributing it incorrectly, as per the code above?)

A calendar generated by GenerateCalendar above, may look something like this:

BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
PRODID:-//My Company//My App//EN
URL:http://localhost/test/
X-WR-CALNAME:Test
BEGIN:VEVENT
DTEND:20110831T100100
DTSTAMP:20111028T091109
DTSTART:20110831T090100
SEQUENCE:0
SUMMARY:Test
UID:1
URL:http://localhost/test/?id=1
END:VEVENT
END:VCALENDAR
like image 413
David Hedlund Avatar asked Oct 28 '11 07:10

David Hedlund


1 Answers

My understanding is that you need to host your calendar on a CalDAV server (https://www.rfc-editor.org/rfc/rfc4791). Simply publishing a file (.ics) is different from hosting a calendar on a calendar engine.

like image 96
fmr Avatar answered Oct 18 '22 03:10

fmr