Reputation: 1
I have a twice-weekly event that I want to generate an ICS file for, so that users can add this series of events to their calendar. I am familar with e.g.
RRULE:FREQ=WEEKLY;BYDAY=MO,TH;
for an event that takes place twice a week on Mondays and Thursdays, but this only lets me generate a calendar event where the event on Mondays has the same start time and duration as the event on Thursdays.
I want to be able to represent e.g. Mondays 9am-10am and Thursdays 4pm-6pm every week, indefinitely, as one recurring event in someone's calendar (so that if this is deleted we can use the cancel method to remove the whole thing, for example).
Is there a format for a single ICS file that could represent the event outlined above? If not, is there another way to achieve this?
I tried including one RRULE overall (as I know this can only be used once per ICS file) and two VEVENTs to represent both the event on Mondays and the event on Thursdays but this did not seem to be a valid ICS file/could not be opened by my mail client.
Upvotes: 0
Views: 64
Reputation: 99831
You may be able to do this using the THISANDFUTURE
parameter, the general approach would be to:
RRULE
in your base VEVENT
object, that recurs for mondays, until a specific date or number of instances.EXDATE
+ RECURRENCE-ID
) on the last Monday event that moves the event all the way back to the beginning of the list but is now for the Thursday event. This event would have to be marked THISANDFUTURE
.Note that this feels pretty hacky and I wouldn't be 100% confident all clients handle this well, but could be worth a shot.
Frankly I think a more reliable approach is to just do a single recurrence rule (for, say, the monday event) and then add an exception for every thursday event. This increases the size of the object quite a bit but is going to be a lot more reliable and really well supported.
Upvotes: 0