检索已删除的日历事件? [英] Retrieve deleted calendar events?

查看:96
本文介绍了检索已删除的日历事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Google Apps Script中检索已删除的日历活动?我试图跟踪我们取消会议的速度。我可以在日历的垃圾箱(文件夹?)中看到已删除的事件,但无法使用CalendarApp的getEvents API检索它们。



我试过使用查询:

pre $ myCalndar.getEvents some_days_past,现在,{search:in:Trash});

以及搜索字符串和可选属性的众多变体,但没有返回任何结果。



有什么想法?

为了记录,我一直在这里记录API:
< a href =https://developers.google.com/apps-script/reference/calendar/calendar-app =nofollow noreferrer> https://developers.google.com/apps-script/reference/calendar / calendar-app

解决方案

您可以使用Calendar API v3。通过启用高级Google服务的日历API和Google API控制台,可以在Google Apps脚本中使用日历API v3。



如何使用它如下。


  1. 脚本编辑器,选择资源>高级Google服务

  2. 在出现的对话框中,点击Calendar API v3的开/关按钮


  3. 在对话框的底部,点击Google API控制台的链接。


  4. 在控制台中,点击进入过滤器框并键入API名称的一部分日历,然后在看到它时单击该名称。

  5. 在下一个屏幕上,单击启用API。
  6. 关闭Developers Console并返回脚本编辑器。在对话框中单击确定。您启用的高级服务现已在自动完成中可用。

  7. https://developers.google.com/apps-script/guides/services/advanced



    检索已删除事件列表的脚本如下所示。如果JSON响应。



    脚本:

      var response = Calendar.Events.list(
    CalendarId,{
    showDeleted:true,
    fields:items(id,summary)
    }
    );

    回应:

      {
    items:[
    {
    id:####,
    summary: test1
    },
    {
    id:####,
    summary:test2
    }
    ]
    }

    在此示例中,id和summary被设置为字段。如果您需要其他字段,请查看 https://developers.google。 COM /谷歌应用程序/日历/ V3 /参考/事件的。



    如果我误解了您的问题,我很抱歉。


    Is there a way to retrieve deleted calendar events in Google Apps Script? I'm trying to keep track of our rate of meeting cancellations. I can see deleted events in the calendar's Trash (folder?), but am unable to retrieve them using the CalendarApp's getEvents API.

    I've tried querying using:

    myCalndar.getEvents(some_days_past, now, {search: "in:Trash"});
    

    as well as numerous variations of search strings and optional properties, but none return any results.

    Any ideas?

    For the record, I've been going by the API documented here: https://developers.google.com/apps-script/reference/calendar/calendar-app

    解决方案

    You can use "Calendar API v3". "Calendar API v3" can be used at Google Apps Script by enabling Calendar API of Advanced Google services and of Google API Console.

    How to use it is as follows.

    1. In the script editor, select Resources > Advanced Google services

    2. In the dialog that appears, click the on/off switch for Calendar API v3

    3. At the bottom of the dialog, click the link for the Google API Console.

    4. In the console, click into the filter box and type part of the name of the API "Calendar", then click the name once you see it.

    5. On the next screen, click Enable API.

    6. Close the Developers Console and return to the script editor. Click OK in the dialog. The advanced service you enabled is now available in autocomplete.

    The detail information is https://developers.google.com/apps-script/guides/services/advanced.

    A script for retrieving a list of trashed events is as follows. Response if JSON.

    Script :

    var response = Calendar.Events.list(
      "CalendarId", {
        showDeleted: true,
        fields: "items(id,summary)"
      }
    );
    

    Response :

    {
      "items": [
        {
          "id": "####",
          "summary": "test1"
        },
        {
          "id": "####",
          "summary": "test2"
        }
      ]
    }
    

    At this sample, id and summary are set as fields. If you want other fields, please check https://developers.google.com/google-apps/calendar/v3/reference/events.

    If I misunderstand your question, I'm sorry.

    这篇关于检索已删除的日历事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆