且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Apps脚本获取Google日历事件附件

更新时间:2023-12-05 20:57:52

您要从事件中检索文件ID.如果我的理解是正确的,那么该示例脚本怎么样?

You want to retrieve file IDs from an event. If my understanding is correct, how about this sample script?

var inStorePartiesCalendarID = "### calendar ID ###";
var eventId = "### Event ID ###";
var res = Calendar.Events.get(inStorePartiesCalendarID, eventId, {fields: "attachments/fileId"});
var fileIds = res.attachments.map(function(e){return e.fileId});
Logger.log(fileIds)

注意:

  • 此示例脚本假定您已经知道事件ID.如果需要用于检索事件ID的方法.请告诉我.
  • 如果要检索附件文件的文件ID和文件名,请对fields使用attachments(fileId,title).
  • Note :

    • This sample script supposes that you have already known the event ID. If you need the method for retrieving the event IDs. Please tell me.
    • If you want to retrieve the file ID and filename of the attachment file, please use attachments(fileId,title) for fields.
      • Calendar.Events.get
      • fields

      如果我误解了你的问题,对不起.

      If I misunderstand your question, I'm sorry.