Google Apps 脚本 - 如何使用高级日历服务过滤多个媒体资源上的日历事件

Google Apps Script - how can one filter calendar events on multiple properties with advanced calendar service

使用 Google Apps Script 的高级日历服务的 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 表示

This parameter might be repeated multiple times to return events that match all given constraints.

解决方案是传递 属性 个值的数组:

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