创建事件时提取日历事件数据

问题描述 投票:0回答:1

我目前正在为自己正在开发的内部产品开发日历插件。本质上,我需要做的是在创建活动时,要提取活动卡中输入的信息,然后将其发送给插件,插件会调用后端服务为基于会议室的会议室实时提取数据。您在活动创建模式中输入的位置,并基于邀请人数。

我看过Calendar service,但找不到能解决我想要的任何东西。我只是想知道是否有可能使用应用程序脚本来完成我需要做的事情。

当前在下面的代码中,event为空,因为在创建事件时尚未创建该事件。但是我在创建信息时需要这些信息。

var event = calendar.getEventById(e.calendar.id);
google-apps-script google-calendar-api google-apps-script-addon google-apps-script-editor
1个回答
0
投票

[事件为creating时,API调用返回事件Resource,该事件可在变量声明后立即使用。结构是:

{
  "kind": "calendar#event",
  "etag": etag,
  "id": string,
  "status": string,
  "htmlLink": string,
  "created": datetime,
  "updated": datetime,
  "summary": string,
  "description": string,
  "location": string,
  "colorId": string,
  "creator": {
    "id": string,
    "email": string,
    "displayName": string,
    "self": boolean
  },
  "organizer": {
    "id": string,
    "email": string,
    "displayName": string,
    "self": boolean
  },
  "start": {
    "date": date,
    "dateTime": datetime,
    "timeZone": string
  },
  "end": {
    "date": date,
    "dateTime": datetime,
    "timeZone": string
  },
  "endTimeUnspecified": boolean,
  "recurrence": [
    string
  ],
  "recurringEventId": string,
  "originalStartTime": {
    "date": date,
    "dateTime": datetime,
    "timeZone": string
  },
  "transparency": string,
  "visibility": string,
  "iCalUID": string,
  "sequence": integer,
  "attendees": [
    {
      "id": string,
      "email": string,
      "displayName": string,
      "organizer": boolean,
      "self": boolean,
      "resource": boolean,
      "optional": boolean,
      "responseStatus": string,
      "comment": string,
      "additionalGuests": integer
    }
  ],
  "attendeesOmitted": boolean,
  "extendedProperties": {
    "private": {
      (key): string
    },
    "shared": {
      (key): string
    }
  },
  "hangoutLink": string,
  "conferenceData": {
    "createRequest": {
      "requestId": string,
      "conferenceSolutionKey": {
        "type": string
      },
      "status": {
        "statusCode": string
      }
    },
    "entryPoints": [
      {
        "entryPointType": string,
        "uri": string,
        "label": string,
        "pin": string,
        "accessCode": string,
        "meetingCode": string,
        "passcode": string,
        "password": string
      }
    ],
    "conferenceSolution": {
      "key": {
        "type": string
      },
      "name": string,
      "iconUri": string
    },
    "conferenceId": string,
    "signature": string,
    "notes": string,
    "gadget": {
    "type": string,
    "title": string,
    "link": string,
    "iconLink": string,
    "width": integer,
    "height": integer,
    "display": string,
    "preferences": {
      (key): string
    }
  },
  "anyoneCanAddSelf": boolean,
  "guestsCanInviteOthers": boolean,
  "guestsCanModify": boolean,
  "guestsCanSeeOtherGuests": boolean,
  "privateCopy": boolean,
  "locked": boolean,
  "reminders": {
    "useDefault": boolean,
    "overrides": [
      {
        "method": string,
        "minutes": integer
      }
    ]
  },
  "source": {
    "url": string,
    "title": string
  },
  "attachments": [
    {
      "fileUrl": string,
      "title": string,
      "mimeType": string,
      "iconLink": string,
      "fileId": string
    }
  ]
}

例如,您可以在创建事件后检索上面的任何字段:

function events(){

  var body = {
    "end": {
      "date": "2020-02-20"
    },
    "start": {
      "date": "2020-02-19"
    }
  }; 

  var event = Calendar.Events.insert(body, 'primary');

  Logger.log("End: " + event.end);
  Logger.log("Start: " + event.start);

}
© www.soinside.com 2019 - 2024. All rights reserved.