Reputation: 13
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 CalendarClient:
" public void executeDelete(Entry entry) throws IOException {
HttpRequest request = requestFactory.buildDeleteRequest(new GenericUrl(entry.getEditLink()));
request.execute().ignore();
} "
What's wrong?
I'm started to build my model from this "base" (calendar-v2-atom-oauth-sample): http://code.google.com/p/google-api-java-client/source/browse/?repo=samples#hg%2Fcalendar-v2-atom-oauth-sample%2Fsrc%2Fcom%2Fgoogle%2Fapi%2Fclient%2Fsample%2Fcalendar%2Fv2%2Fmodel
Upvotes: 0
Views: 1177
Reputation: 26
Added this to EventEntry.java:
@Key("@gd:etag")
public String etag;
Added this to CalendarClient.java:
public void executeDelete(Entry entry) throws IOException {
HttpRequest request = requestFactory.buildDeleteRequest(new GenericUrl(entry.getEditLink()));
if (entry instanceof EventEntry) {
request.headers.ifMatch = ((EventEntry) entry).etag;
}
request.execute().ignore();
}
Upvotes: 1
Reputation: 1
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:
Gonna have to keep digging to find the delete event solution.
Upvotes: 0