Skip to content Skip to sidebar Skip to footer

Google Calendar Api With Android - Delete Event

I would like to delete an event from a calendar with the followoing code: //insertedEntry: I want to delete it. 'client.executeDelete(insertedEntry);' in the Class CalendarClie

Solution 1:

Added this to EventEntry.java:

@Key("@gd:etag")public String etag;

Added this to CalendarClient.java:

publicvoidexecuteDelete(Entry entry)throws IOException {
        HttpRequestrequest= requestFactory.buildDeleteRequest(newGenericUrl(entry.getEditLink()));
        if (entry instanceof EventEntry) {
            request.headers.ifMatch = ((EventEntry) entry).etag;
        }
        request.execute().ignore();
    }

Solution 2:

I've just encountered this as well getting a 403 Forbidden error.

Interesting that CalendarClient.executeDelete works for a CalendarEntry as shown in this example:

http://samples.google-api-java-client.googlecode.com/hg/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/CalendarAndroidSample.java

Gonna have to keep digging to find the delete event solution.

Post a Comment for "Google Calendar Api With Android - Delete Event"