java - 谷歌日历 api 删除未来事件
问题描述
我正在尝试从它告诉您使用的文档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();
并给我以下内容:
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."
}
任何帮助将不胜感激,谢谢!
解决方案
使用 Calendar API 删除事件将使用events.delete。您可以使用 Try-it 进行测试。
推荐阅读
- spring - 运行两个 Spring Boot 实例
- formula - Netsuite - 保存的搜索:显示可用的套件
- airflow - 如何将气流日志写入 Elasticsearch?
- ruby-on-rails - Rails 5 - 无法验证 CSRF 令牌的真实性 - 只有有时
- android - 当我尝试将数据从一个活动传递到另一个活动时,我的应用程序崩溃了
- node.js - 将 req.body 中的空字符串 ''" 替换为 null/undefined
- java - 将 main 方法中的变量与另一个 Java 方法连接起来
- react-native - AppCenter Yarn 1.19 错误从缓存中获取时完整性不正确
- html - 如何均匀分布
- 使用 Flexbox 的导航栏中的项目?HTML
- javascript - 使用 Javascript 变量设置 HTML 属性?