How to delete a single event from a recurring set using ical programmatically?

空扰寡人 提交于 2021-02-10 08:43:15

问题


I have created a recurring ical event, on 10,11th Please see below, and I want to delete 10th event so I used MEthod: Cancel, but as the UID is same both the records are getting deleted. How to delete only one record, should I use any other value like UID?

BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH

BEGIN:VEVENT
DTSTART:20150910T100000
DTSTAMP:20150910T115449Z
RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20150911T110000
UID:78163local
Location: Test
DESCRIPTION:test
LAST-MODIFIED:20150910T115449Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:service
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

Cancel event code :

BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:CANCEL
BEGIN:VEVENT
DTSTART:20150910T100000
DTEND:20150911T110000
DTSTAMP:20150910T115714Z

UID:78163local
Location: Test
DESCRIPTION:Test
LAST-MODIFIED:20150910T115714Z
SEQUENCE:1
STATUS:CANCELLED
SUMMARY:service
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

回答1:


If you want to delete only one instance, you need to specify the RECURRENCE-ID of the instance that you want to delete.

The RECURRENCE-ID of the instance corresponds to the original DTSTART of that instance. So in your case, your cancel should have something like:

DTSTART:20150910T100000
RECURRENCE-ID:20150910T100000

See also http://tools.ietf.org/html/rfc5546#section-4.4.3




回答2:


You need to have the RECURRENCE-ID and also other possible way I found is to delete the created another recur ical with the same UID and use METHOD as REQUEST rather than PUBLISH, it deletes the older recur events and updates with new one excluding a particular mentioned date.

See below link for more http://www.techfolks.net/ical-recurring-appointment-with-rrule-exdate-examples/



来源:https://stackoverflow.com/questions/32507030/how-to-delete-a-single-event-from-a-recurring-set-using-ical-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!