Question

To summarize what is coming:

  • How can I dispatch the calendar via a link?
  • Why is the calendar fully working when first saved on my local PC and cannot be modified when taken directly from the web though it is imported without messages?
  • How can I find the cause of the failed modification?

Full explanation:

I am developing an application which produces a ICS Calendar. This calendar is dispatched to users via a URL. So far, I found out the user can import the calendar through Calendar tab -> New Calendar -> On the Network. Then providing the URL where the calendar is generated and following the wizard causes a new calendar to be created. This works just fine, even though I would like to find a way to allow the user to import the calendar (triggering the wizard automatically if that's the case) just clicking on my link. I tried embedding the link in a mail, but then when clicked it triggers the browser (if it is provided in HTTP protocol or an error when provided with WebDAV protocol). Do you know any way to produce a link which can achieve my goal?

However, the real problem is another. When I import the calendar as described (Calendar tab -> New Calendar -> On the Network) and then I try to modify any event data, I get a MODIFICATION_FAILED message, and the error console simply shows

Timestamp: 03/14/2013 12:20:08 PM
Error: An error occurred when writing to the calendar Test! Error code: MODIFICATION_FAILED. Description: 
Source File: resource://calendar/modules/calUtils.jsm -> file:///home/mdavi/.thunderbird/sdq097yy.default/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calCalendarManager.js
Line: 976

How can I find the cause of this error? Moreover, I tried to export the generated calendar (or to download it from my link) to an ICS file, then to open such file via File -> Open -> Calendar File ... without modifying anything in the exported file and in this way I can even modify event data. So why? The ICS file I generated is very simple and looks like:

BEGIN:VCALENDAR
PRODID:-//Events Calendar//iCal4j //EN
METHOD:PUBLISH
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:...
SUMMARY:...
DTSTART:...
DTEND:...
DESCRIPTION:...
LOCATION:...
URL:...
END:VEVENT
END:VCALENDAR

All the properties of VEVENT are well formed.

Was it helpful?

Solution

I'm not sure if you are planning to allow users to remotely change the events on your calendar or if you want them to import the calendar data into their own calendars. I'm assuming you are doing the first and have chosen the type "iCalendar". First of all some explaination, there are distinct differences between the types:

  • iCalendar: This mode uses WebDAV which initially is not made for calendaring data but for transferring files. To save calendaring data, the .ics file is downloaded, modified and then uploaded again
  • CalDAV: This is an extension to WebDAV, that is made specifically for calendaring. There are additional queries that are made to figure out what the server supports. Each event can be queried specifically, so a client doesn't have to upload the whole file.

If you are using the iCalendar type, your web application must support a few more queries:

  • PUT /path/to/calendar.ics: This query is made to save the file to the server. If you don't support this method, a MODIFICATION_FAILED will be thrown.
  • PROPFIND /path/to/calendar.ics: This is probably optional, but will help reduce network load and avoid dataloss. An ETag query is done to find out if the file has changed. This ETag is then used in the If header to only PUT if the file hasn't changed.

If you want to provide CalDAV access, I suggest you take one of the existing open source CalDAV servers and write a backend to it that uses your data.

Unfortunately, Lightning does not have a way to make the Link trigger automatic subscription, but when it does it will probably be through the webcal:// and webcals:// schemes. I don't know if they are standard, but they are at least commonly used.

When choosing File > Open > Calendar File, what you are doing is subscribing to a local calendar using a file:// URI. If you remove the file, you will lose your calendar. If you instead want to import the events to an internal calendar, what you need to do is create a local calendar, then use the Events and Tasks menu to import events from a file. There is no way to do that with a remote file without downloading it.

For more debugging, you can open the advanced config editor in Options > Advanced > General > Config Editor and then enable the preferences calendar.debug.log and calendar.debug.log.verbose. Newer versions of Lightning might have more debug info prefixed with [calICSCalendar].

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top