简体   繁体   中英

google calendar api delete future events

I am trying to delete future google calendar events, from the docs it tells you to use events.update() and the closest that I have got was with this:

 Events events = calendar.events().instances("primary", eventId).execute(); Event instance = events.getItems().get(0); String[] recurrence = new String[]{"RRULE:UNTIL=" + new DateTime(new Date())}; instance.setRecurrence(Arrays.asList(recurrence)); calendar.events().update("primary", eventId, instance).execute(); 

and gives me the following:

 com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code": 400, "errors": [ { "domain": "global", "message": "Value 'k6nni7i7p54hb82p3p6eh9emg8_20180830T174500Z' in content does not agree with value 'k6nni7i7p54hb82p3p6eh9emg8'. This can happen when a value set through a parameter is inconsistent with a value set in the request.", "reason": "invalidParameter" } ], "message": "Value 'k6nni7i7p54hb82p3p6eh9emg8_20180830T174500Z' in content does not agree with value 'k6nni7i7p54hb82p3p6eh9emg8'. This can happen when a value set through a parameter is inconsistent with a value set in the request." } 

Any help would be appreciated, thanks!

Deleting events using Calendar API would make use of the events.delete . You can test this using the Try-it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM