更新:这是我从谷歌开发团队收到的,希望对某人有用:
stanc 对问题 3110 的评论 #4...@google.com:将事件从全天修补到非全天失败
http://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3110
补丁操作采用原始事件并更改/添加/删除请求指定的条目。如果您针对全天事件向 PATCH 操作发送以下请求:
{
"start": {
"dateTime": "2012-05-17T06:30:00+06:30",
"timeZone": "UTC"
},
"end": {
"dateTime": "2012-05-17T07:30:00+06:30",
"timeZone": "UTC"
}
}
结果事件最终会同时设置 dateTime 和 date 字段(这是不允许的)。因此,PATCH 请求需要清除日期字段:
{
"start": {
"dateTime": "2012-05-17T06:30:00+06:30",
"timeZone": "UTC",
"date": null
},
"end": {
"dateTime": "2012-05-17T07:30:00+06:30",
"timeZone": "UTC",
"date": null
}
}
在代码中,当你想将字段 Date 设置为 null 时,你必须像这样输入Data.NULL_DATE_TIME:
EventDateTime edt = new EventDateTime();
edt.put("date",Data.NULL_DATE_TIME);// if you put NULL, it doesn't retain.
edt.put("dateTime", newTime); //newTime is the new value you want to set, type DateTime