【问题标题】:Google Apps Script - how can one filter calendar events on multiple properties with advanced calendar serviceGoogle Apps 脚本 - 如何使用高级日历服务过滤多个属性上的日历事件
【发布时间】:2020-04-16 00:38:18
【问题描述】:

在使用 Google Apps 脚本的高级日历服务的 Calendar.Events.list 时,如何过滤多个 privateExtendedProperty 值?

    var existing_events = Calendar.Events.list(calendar,{'privateExtendedProperty':'copperOpportunityId='+opportunity['id'],
                                                         'privateExtendedProperty':'copperFieldId=shoots',
                                                         'orderBy':"startTime",
                                                         'singleEvents':true
                                                        }
                                              );

不会起作用,因为过滤器对象的第二个“privateExtendedProperty”属性会覆盖第一个,API 只接收后一个。

同时API Documentation 状态

此参数可能会重复多次以返回匹配所有给定约束的事件。

【问题讨论】:

  • 在 Google 高级服务中,当查询参数中使用相同的键时,该键有一个数组。其他语言的googleapis也是如此。我可以从他们那里知道这件事。例如,电子表格.values.batchGet 就是同样的情况。 Ref 但这在官方文档中找不到。所以我认为你的帖子对其他用户很有用。

标签: google-apps-script google-calendar-api


【解决方案1】:

解决方法是传递一个属性值数组:

var existing_events = Calendar.Events.list(calendar,{'privateExtendedProperty':                                                   
                                                       ['copperOpportunityId='+opportunity['id'],
                                                        'copperFieldId=shoots'
                                                       ],
                                                     'orderBy':"startTime",
                                                    'singleEvents':true
                                                   }
                                               );

【讨论】:

    猜你喜欢
    • 2014-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多