简体   繁体   English

谷歌 API 触发器无法识别其参与者或组织者

[英]Google APIs Triggers not identifying if its Participants or Organizer

Our Add-in has set triggers (ScriptApp.newTrigger('myFunction')) to identify on any calendar change so that we update meeting data(Title, Participants Email, Start and End date etc) back to our DB.我们的插件已设置触发器(ScriptApp.newTrigger('myFunction')) 以识别任何日历更改,以便我们将会议数据(标题、参与者电子邮件、开始和结束日期等)更新回我们的数据库。 The challenge we are facing is that the if a participant is accepting/declining/cancelling a single meeting or a series, part of series etc we receive notifications and that calendar event object does not have any object to identify its a trigger caused due to participant activity and in which case we dont need to do any action.我们面临的挑战是,如果参与者接受/拒绝/取消单个会议或系列、系列的一部分等,我们会收到通知,并且该日历事件对象没有任何对象来识别其由参与者引起的触发器活动,在这种情况下,我们不需要执行任何操作。

To explain a case -解释一个案例——

  1. Organizer schedules a series for 4 instances and includes 2 participants.组织者为 4 个实例安排了一个系列,包括 2 个参与者。
  2. One participant cancels the meeting for last two events.一位参与者取消了最后两个事件的会议。
  3. We receive event that does not identify that its action from participant and end up updating.我们收到的事件未从参与者那里识别其行为并最终更新。 meeting as cancelled.会议取消。 (Ideally we should get the trigger only when Organizer cancelled). (理想情况下,我们应该只在 Organizer 取消时才获得触发器)。

There are objects in events to identify if its organizer or participant but these always return "self:true".事件中有对象可以识别其组织者还是参与者,但这些对象总是返回“self:true”。

"creator":{
      "self":true,
      "email":"dev@******.com"
   },
   "organizer":{
      "self":true,
      "email":"dev@******.com"
   }, 

Is there any way we either restrict to receive notifications ONLY when organizer does any calendar update?有什么方法可以限制我们仅在组织者进行任何日历更新时接收通知?

OR或者

Any way to identify from the calendar event object that this trigger is caused due to participant action?有什么方法可以从日历事件对象中识别出此触发器是由参与者操作引起的?

I understand that you want to run the trigger only if the user that fires it is the event organizer.我知道您只想在触发触发器的用户是活动组织者时才运行触发器。 There exists a property that can help you easily manage that operation: the organizer property of the attendee object, inside the event object.有一个属性可以帮助您轻松管理该操作:事件对象内部的attendee对象的organizer属性。 That property will contain true if the attendee is an organizer for this event, and false otherwise.如果与会者是此活动的组织者,则该属性将包含true ,否则为false So you only need to include a line of code in the script to check that property and keep running only if it is equal to true .因此,您只需要在脚本中包含一行代码来检查该属性并仅在它等于true继续运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM