0

I'm trying to manipulate CalDAV events with EventKit or a third-party library. I have a CalDAV server hosted in my local network and I added some extra property parameters in the RESOURCES property of a VEVENT, it looks like:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
CREATED:20160108T144516Z
UID:9ED5366B-E3BD-4C32-BA67-4B9A1F5D39F7
DTEND:20160224T093000
TRANSP:OPAQUE
RESOURCES;X-ORE-IPP=%14119%;X-ORE-RES=%3%;X-ORE-STATUT=%103%;X-ORE-TYPE=
 %3%:
SUMMARY:summary test
DTSTART:20160224T090000
DTSTAMP:20160224T075721Z
LAST-MODIFIED:20160224T075721Z
SEQUENCE:0
DESCRIPTION:EII 25 27 lioei
 anto)
END:VEVENT
END:VCALENDAR

With EventKit we can manipulate some properties of the events but can how can we access the custom property parameters??

hnh
  • 13,957
  • 6
  • 30
  • 40
Robin Delaporte
  • 575
  • 5
  • 15
  • Can you provide more information on your iOS implementation of this? are you setting events on someone's calendar and then trying to pull custom data from those events? Or trying to set events to a calendar? – bolnad Feb 27 '16 at 13:28
  • In first place I would like to get all events. The calendar comes from a JavaScript/HTML calendar. As you know apple recognize CalDav and it is easy to implement events from it. I guess it becomes more complicated when we want to get all the datas from a CalDav event. CalDav allows us to write extra fields wrapped in a event. Although you are right, I'm trying to get events and pull custom datas – Robin Delaporte Feb 27 '16 at 17:17

1 Answers1

1

The API provided by the current EventKit is very limited and does not give you access to custom properties or custom property parameters. (It should however preserve the custom parameters - though RESOURCES may have special behaviour).

In short: What you want is not possible with EventKit. You'll either need to implement CalDAV on your own or use a 3rd party library - CalConnect maintains a list.

P.S.:

Also your (ab)use of RESOURCES doesn't look quite right to me. First - it doesn't seem to have a value. That would probably confuse clients (they might just drop it - because, well, it doesn't specify any resources.

Then RESOURCES is a pretty plain but multivalue property, e.g. from the RFC:

RESOURCES:EASEL,PROJECTOR,VCR

Your usage seems to suggest that your custom property parameters belong to a single resource (status etc). In iCalendar such scheduling is not usually done with the RESOURCES property but with the ATTENDEE property and a CUTYPE RESOURCE, like:

ATTENDEE;CUTYPE=ROOM;STATUS=ACCEPTED:ore://localhost/rooms/28372
ATTENDEE;CUTYPE=RESOURCE:STATUS=TENTATIVE:ore://localhost/beamers/8347

I don't know what your actual 'ORE' use case is. If it is compatible with CalDAV (which I guess should be desirable), you might use ATTENDEE. If NOT it is probably better to use a custom property instead of custom property parameters, like that:

X-ORE-RESOURCE;STATUS=ACCEPTED:ore://localhost/rooms/28372

Note that you might want to use standard property parameters on that custom property (e.g. STATUS instead of X-ORE-STATUS).

P.S.2: Your VCALENDAR uses floating time. That is technically valid but very few clients support that. Clients usually use floating dates for all-day events but UTC or TZ times for events with a time. They can probably read it, but will attach their local timezone if they edit the event. And by that make the event non-floating. Not sure whether that matters to you, but quite likely it is a good idea to attach a TZID.

P.S.3: Your VCALENDAR lacks a PRODID.

Community
  • 1
  • 1
hnh
  • 13,957
  • 6
  • 30
  • 40
  • Thank you hnh for your answer. I guess you are right for the abuse of RESOURCES. I'm refactoring a JS CalDav Client and a iOS app so it is good to have you telling me what I'm doing wrong. Now I have to code my own iOS CalDav Client :) – Robin Delaporte Mar 01 '16 at 11:10
  • @Delparo did it work completely to implement a iOS CalDAV client? Are you able to retrieve all events and locations (conference rooms)? Do you have any library to speed this development? – Arthur Jardim Giareta Conti Aug 04 '16 at 11:53
  • Hi Arthur, I was able to retrieve events(and metadatas) from a CalDav server thanks a Php framework (https://github.com/wvrzel/simpleCalDAV). But it is not optimized, and I encountered several bugs – Robin Delaporte Aug 08 '16 at 13:34