Garethp / php-ews

PHP Exchange Web Services
BSD 3-Clause "New" or "Revised" License
112 stars 45 forks source link

Also delete recurring events when master event is deleted? #259

Open Lxxrxns opened 10 months ago

Lxxrxns commented 10 months ago

When I create a recurring event, the repeats ('children' if you will) get slightly different itemIds, which makes it hard to find and delete them later on.

How can I delete all recurrences when deleting the master event?

Because even if I delete the "master" event (i.e. the first event) based on that itemId and changeKey, the recurring event still remains in the calendar...

I created the following recurring event, which is shown as two events when I do getCalendarItems:

Subject: Test 5
Start: 2020-01-05T09:00:00Z
End: 2020-01-05T10:00:00Z
itemId: AAMkADJhY2ZmMDRkLWEzNjctNGI4MS05M2M0LTVhYzViNmRlZmU5ZAFRAAgI15FyNSMAAEYAAAAANTLcdKApVk26/E16wDmruwcAYhwxX7uX10ikCHfRdGwnRQAAAAABDQAAYhwxX7uX10ikCHfRdGwnRQADVJTimwAAEA==
changeKey: DwAAABYAAABiHDFfu5fXSKQId9F0bCdFAANUyPtZ
uID: 040000008200E00074C5B7101A82E0080000000098478BB6F633DA01000000000000000010000000B2233F11011B0B42BC1A45162B66757E

Subject: Test 5
Start: 2020-01-06T09:00:00Z
End: 2020-01-06T10:00:00Z
itemId: AAMkADJhY2ZmMDRkLWEzNjctNGI4MS05M2M0LTVhYzViNmRlZmU5ZAFRAAgI15I7X4zAAEYAAAAANTLcdKApVk26/E16wDmruwcAYhwxX7uX10ikCHfRdGwnRQAAAAABDQAAYhwxX7uX10ikCHfRdGwnRQADVJTimwAAEA==
changeKey: DwAAABYAAABiHDFfu5fXSKQId9F0bCdFAANUyPtZ
uID: 040000008200E00074C5B7101A82E0080000000098478BB6F633DA01000000000000000010000000B2233F11011B0B42BC1A45162B66757E

Then I do:

// Get the item based on its itemId and changeKey that we stored: 
$item= $calendar->getCalendarItem($itemId, $changeKey);

// Delete that item:
$calendar->deleteCalendarItem($item->getItemId());

In which I provided the $itemId and $changeKey of the MASTER event. However, this ONLY deletes the first event, NOT the second one.

Any ideas?

Lxxrxns commented 10 months ago

Update: having the same problem with updating. Even though the events are supposed to be recurrences of a master event, changing the subject of the master event does not update the recurrences...