我正在访问Google Calendar REST API for Calendar Events,试图为 q 参数找出正确的表示法,以过滤所有通过电子邮件标识出参加者之一的事件(例如foo @ bar .com)
我尝试过:q = attendee.email:foo@bar.com,q=attendee.email=foo@bar.com,q=attendees.email=foo@bar.com,q = attendees.email = “ foo@bar.com” ...
但没有结果(填写 q 参数后为空列表)
完全支持吗?
是否有有效的 q 参数字段列表供您过滤?
答案 0 :(得分:0)
您不能使用任何Calendar API调用直接搜索参与者。
但是,您可以通过代码来实现。如果您写的电子邮件与参加者中的电子邮件重合,则必须列出所有事件,循环浏览它们并过滤事件。例如:
function searchEvents() {
var calendarId = "primary";
var email = "test@email.com";
var result = Calendar.Events.list(calendarId).items;
for (var i = 0; i < result.length; i++){
if (result[i].attendees != undefined){ //Filters out the events without attendees
for (var j = 0; j < result[i].attendees.length; j++){
if (result[i].attendees[j].email == email){
Logger.log(result[i]); //It returns all the event information
}
}
}
}
}
完整的资源对象返回:
{
"kind": "calendar#calendarListEntry",
"etag": etag,
"id": string,
"summary": string,
"description": string,
"location": string,
"timeZone": string,
"summaryOverride": string,
"colorId": string,
"backgroundColor": string,
"foregroundColor": string,
"hidden": boolean,
"selected": boolean,
"accessRole": string,
"defaultReminders": [
{
"method": string,
"minutes": integer
}
],
"notificationSettings": {
"notifications": [
{
"type": string,
"method": string
}
]
},
"primary": boolean,
"deleted": boolean,
"conferenceProperties": {
"allowedConferenceSolutionTypes": [
string
]
}
}
参考: