Reputation: 484
I wanted to delete single event from recurring event by Google Calendar API.
I've added an recurring event with :
$GoogleCalendarID = '123';
$data = array(
'id' => '123',
'summary' => 'Test Title',
'description' => 'Test Description',
'start' => array(
'dateTime' => '2020-05-18T09:15:00+08:00',
'timeZone' => 'Asia/Brunei',
),
'end' => array(
'dateTime' =>
'2020-05-18T09:15:00+08:00',
'timeZone' => 'Asia/Brunei',
),
'recurrence' => array(
'RRULE:FREQ=WEEKLY;COUNT=10;BYDAY=MO;',
),
'attendees' => array(
array(
'email' => '[email protected]',
'displayName' => 'Test Name'
)
));
// Add event
$event = new Google_Service_Calendar_Event($data);
// Delete event (single)
$service->events->delete('primary', '123');
123 -> this id will delete the entire recurring events.
Upvotes: 1
Views: 1762
Reputation: 117301
Try this Modifying or deleting instances
To modify a single instance (creating an exception), client applications must first retrieve the instance and then update it by sending an authorized PUT request to the instance edit URL with updated data in the body.
$events = $service->events->instances("primary", "eventId");
// Select the instance to cancel.
$instance = $events->getItems()[0];
$instance->setStatus('cancelled');
$updatedInstance = $service->events->update('primary', $instance->getId(), $instance);
// Print the updated date.
echo $updatedInstance->getUpdated();
Search this page for cancelled it shows the information about the update body request events.update
Upvotes: 1