I am creating an ical event dynamically in my web application and when someone cancel the appointment on the application we are generating a delete ical event *.ics file to their email to remove the event in their calendar.
Creating is working perfectly but when we try to delete the appointment we created it doesn't remove it from the calendar
Creating Ical event code :
string[] contents = {
"BEGIN:VCALENDAR",
"VERSION:2.0",
"PRODID:-//dev.com//iCal//EN",
"X-WR-CALNAME:development",
"X-WR-RELCALID:928C8448-048A-4aa2-BE27-A920773AF3DC",
"X-FUNAMBOL-ALLDAY:0",
"METHOD:REQUEST",
"BEGIN:VEVENT",
"UID:" + Args.EventUID,
"SEQUENCE:1",
"DTSTART:" + Args.EventStartTime.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"),
"DTEND:" + Args.EventEndTime.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"),
"LOCATION: " + Args.EventLocation,
"ORGANIZER: [email protected]",
"DESCRIPTION;ENCODING=ESCAPED-CHAR:" + Args.EventName,
"SUMMARY:" + Args.EventDescription,
"STATUS:CONFIRMED",
"TRANSP:OPAQUE",
"PRIORITY:" + Args.EventPriority.ToString(),
"END:VEVENT",
"END:VCALENDAR"
};
Creating an event works perfectly on iphone/android/outlook
Delete event part:
string[] contents = {
"BEGIN:VCALENDAR",
"VERSION:2.0",
"METHOD:CANCEL",
"X-WR-CALNAME:development",
"X-WR-RELCALID:928C8448-048A-4aa2-BE27-A920773AF3DC",
"PRODID:-//dev.com//iCal//EN",
"X-FUNAMBOL-ALLDAY:0",
"BEGIN:VEVENT",
"UID:" + Args.EventUID,
"SEQUENCE:2",
"DTSTART:" + Args.EventStartTime.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"),
"DTEND:" + Args.EventEndTime.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"),
"LOCATION: " + Args.EventLocation,
"DESCRIPTION;ENCODING=ESCAPED-CHAR:" + Args.EventName,
"SUMMARY:" + Args.EventDescription,
"ORGANIZER: [email protected]",
"PRIORITY:" + Args.EventPriority.ToString(),
"STATUS:CANCELLED",
"TRANSP:OPAQUE",
"END:VEVENT",
"END:VCALENDAR"
};
When I click this file generated to remove the event that is already created it doesn't remove the event and sometimes it duplicates the event.
The ical UID on creating and delete are the same.
Try using
PUBLISH
asMETHOD
and0
asSEQUENCE
for submitting and1
asSEQUENCE
for erasing.Example of submitting:
Example of erasing: