简体   繁体   English

谷歌日历API删除未来事件

[英]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: 我正在尝试从文档中删除未来的Google日历事件,它告诉您使用events.update()而与此最接近的是:

 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 . 使用Calendar API删除事件将利用events.delete You can test this using the Try-it. 您可以使用Try-it进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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