PHP Extension Google Calendar: Delete a Calendar

Back to Index

Deletes an entry on the user's calendar list. (i.e. Deletes a calendar.)
This example deletes the calendar having the calenderId = "". The calendar ID's can be obtained by listing the calendars.
A response status code equal to 204 indicates success (with no response body).



// The version number (9_5_0) should match version of the Chilkat extension used, omitting the micro-version number.
// For example, if using Chilkat v9.5.0.48, then include as shown here:

$rest = new CkRest();

//   Provide a previously obtained OAuth2 access token.
$oauth2 = new CkOAuth2();

$success = $rest->Connect('',443,true,true);
if ($success != true) {
    print $rest->lastErrorText() . "\n";

$sbResponse = new CkStringBuilder();
$success = $rest->FullRequestNoBodySb('DELETE','/calendar/v3/users/me/calendarList/',$sbResponse);
if ($success != true) {
    print $rest->lastErrorText() . "\n";

if ($rest->get_ResponseStatusCode() != 204) {
    print 'Received error response code: ' . $rest->get_ResponseStatusCode() . "\n";
    print 'Response body:' . "\n";
    print $sbResponse->getAsString() . "\n";

print 'Example Completed.' . "\n";