[英]Clear all events Google calendar Java
I need to delete all my calendar events. 我需要删除所有日历事件。
I saw the API that's the way to delete all events: 我看到了删除所有事件的API:
// Clear a calendar
service.calendars().clear('primary').execute();
So, I do this in my code : 所以,我在代码中这样做:
service.calendars().clear(CALENDAR_ID).execute();
I have the necessary authorization but I'm having this error : 我有必要的授权,但出现此错误:
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Cannot clear primary calendar.",
"reason" : "invalid"
} ],
"message" : "Cannot clear primary calendar."
}.
How do I solve this problem ? 我该如何解决这个问题?
Clears a primary calendar.
清除主日历。 This operation deletes all events associated with the primary calendar of an account.
此操作将删除与帐户的主日历关联的所有事件。
It only works on the primary calendar you need to do 它仅适用于您需要执行的主日历
service.calendars().clear('primary').execute();
not use a calendar id. 不要使用日历ID。
Have the same problem. 有同样的问题。 Try to delete all evens from a calendar because some of them are bugged and it's impossible to delete them one by one.
尝试从日历中删除所有偶数,因为其中一些偶数已被窃听,并且不可能一一删除。 For example :
例如 :
1 : 1:
kind "calendar#event"
etag "\"3137773029614000\""
id "3s3rabieiic4602kq267cu5t6n"
status "cancelled"
2 : 2:
kind "calendar#event"
etag "\"3137773029614000\""
id "3s3rabieiic4602kq267cu5t6n_20180627T080000Z"
status "cancelled"
recurringEventId "3s3rabieiic4602kq267cu5t6n_R20180627T080000"
originalStartTime
dateTime "2018-06-27T10:00:00+02:00"
timeZone "Europe/Paris"
AS you can see, they are approximately the same ID. 如您所见,它们的ID大致相同。 I have 6 more like that.
我还有6个这样的地方。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.