我正在尝试从与Google资源日历相关的Google日历活动中删除一些与会者,同时使用API文档Try It API Explorer上的工具,使用具有管理员权限的域管理员帐户进行适当授权在那个日历上,
我正在发送请求正文,从活动中删除两位与会者,API结果为200 OK,但与会者仍然在那里..
我已经尝试添加新的与会者或更新其状态,但工作正常,但不能删除与会者。
任何人都知道我在这里缺少什么?我也试过通过GAS使用它,我遇到了同样的问题,但是放弃了我尝试使用官方API试用它的任何自编程问题
请求
PATCH
https://www.googleapis.com/calendar/v3/calendars/supportworld.com.ar_34373XXXXXXXXXXX2%40resource.calendar.google.com/events/osrd3lXXXXXXXolks?fields=attendees%2Cid&key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29.bwAXXXXXXXXJOeCUAAADDYWT-QXXXXXXXXXXrc_eGP6Lk7CXXXXXXXXJ6130__ci_-_YXXXXxs
X-JavaScript-User-Agent: Google APIs Explorer
{
"attendees": [
{
"organizer": true,
"email": "xxxxx@netuxxxxxxrp.com",
"responseStatus": "accepted",
"displayName": "AAAAAAA"
},
{
"self": true,
"resource": true,
"email": "supportworld.com.ar_34373XXXXXXXXXXX2@resource.calendar.google.com",
"responseStatus": "accepted",
"displayName": "Cafetera"
}
],
"id": "osrd3lXXXXXXXolks
"
}
响应
200 OK
cache-control: no-cache, no-store, max-age=0, must-revalidate
content-encoding: gzip
content-length: 294
content-type: application/json; charset=UTF-8
date: Thu, 28 Aug 2014 16:15:06 GMT
etag: "XXXXXXXXX"
expires: Fri, 01 Jan 1990 00:00:00 GMT
pragma: no-cache
server: GSE
{
"id": "osrd3lids0gkoeaggp2c95olks",
"attendees": [
{
"email": "xxxxx@netuxxxxxxrp.com",
"displayName": "AAAAAAA",
"organizer": true,
"responseStatus": "accepted"
},
{
"email": "yyyyy@netuxxxxxxrp.com",
"displayName": "YYYYYYY",
"responseStatus": "accepted"
},
{
"email": "zzzzz@netuxxxxxxrp.com",
"displayName": "BBBBBB",
"responseStatus": "needsAction"
},
{
"email": "supportworld.com.ar_34373XXXXXXXXXXX2@resource.calendar.google.com",
"displayName": "Cafetera",
"self": true,
"resource": true,
"responseStatus": "accepted"
}
]
}
参赛作品:
{
"email": "yyyyy@netuxxxxxxrp.com",
"displayName": "YYYYYYY",
"responseStatus": "accepted"
},
{
"email": "zzzzz@netuxxxxxxrp.com",
"displayName": "BBBBBB",
"responseStatus": "needsAction"
}
不应再存在了,但它们是......对此有任何帮助,
答案 0 :(得分:0)
我在C#中使用它,我认为在其他语言中它将以相同的方式工作。
当我尝试从列表中删除不需要的与会者时,它无效。
eventItem.Attendees.Remove(new EventAttendee { Email = "<to be removed>@gmail.com" });
我想你已经达到了这一点。
但是当我在没有与会者的情况下用另一个列表替换列表时,它工作正常,其他与会者甚至没有收到有关任何更改的通知。
eventItem.Attendees = eventItem.Attendees.Where(a => a.Email != "<to be removed>@gmail.com").ToList();
当然还有补丁/更新。
service.Events.Patch(eventItem, "primary", eventItem.Id).Execute();