如何解决是否可以在谷歌日历中修补受邀者的响应状态?
我正在使用谷歌日历 API,我想知道是否可以修补/更新受邀者的响应状态。我能够访问用户的谷歌日历并插入、删除和更新他们的谷歌日历。但我不知道如何更改用户的响应状态。
这是我的 patchdate 函数,我正在尝试修补事件。
function patchDate(calendarid,dateFormat) {
gapi.client.load('calendar','v3',function() { // load the calendar api (version 3)
var request = gapi.client.calendar.events.patch({
'calendarId': 'primary',// calendar ID
"eventId": calendarid,// pass event id
"sendNotifications": true,"resource": dateFormat // pass event details with api call
});
// handle the response from our api call
request.execute(function(resp) {
if(resp.error || resp == false) {
console.log("failed to update")
} else {
console.log("successfully updated")
}
console.log(resp);
});
});
}
这就是我调用函数的方式。我正在传递我想要修补的用户电子邮件。谷歌日历活动中有多个电子邮件地址,但我只想更改其中一个。在这种情况下,这将是 example@.com
var dateFormat = {
"email": 'example@.com',"responseStatus": 'accepted'
};
patchDate(tableData[6],dateFormat)
当我尝试修补事件时收到 200 ok 响应,但响应状态没有改变。
解决方法
如果您查看 event resource 的文档,则 responseStatus 似乎是可写的。
您的代码对我来说看起来不错,但如果它不起作用,那么我建议您向 issue forum
提交问题 ,您的 dateFormat
对象应该包含在您缺少的 "attendees":[]
对象中,因此您的补丁没有被应用。 "resource"
应如下所示:
"resource": {
"attendees": [
{
"responseStatus": "tentative","email": "example@.com"
}
]
}
您可以将 dateFormat
更改为
var newDateFormat = {"attendees":[dateFormat]}
我用这里试试这个:https://developers.google.com/calendar/v3/reference/events/patch#try-it
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。