且构网

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

我在哪里可以找到任务列表ID

更新时间:2022-12-23 15:12:46

如果要使用Google Apps脚本检索任务列表ID,该示例脚本如何?

If you want to retrieve the tasklist IDs using Google Apps Script, how about this sample script?

要使用示例脚本,请在运行脚本之前,先在Advanced Google Services和API控制台上启用Tasks API,如下所示.

In order to use the sample script, before you run the script, please enable Tasks API at Advanced Google Services and API console as follows.

  • 在脚本编辑器上
    • 资源->高级Google服务
    • 打开Tasks API v1
    • 在脚本编辑器上
      • 资源-> Cloud Platform项目
      • View API控制台
      • 在入门"中,单击探索并启用API".
      • 在左侧,单击库.
      • 在搜索API和服务"中,输入任务API".然后点击任务API".
      • 单击启用"按钮.
      • 如果已启用API,请不要关闭.

      启用Tasks API后,请运行以下脚本.

      After Tasks API was enabled, please run the following script.

      function myFunction() {
        var taskLists = Tasks.Tasklists.list().getItems();
        var res = taskLists.map(function(list) {
          return {
            taskListId: list.getId(),
            listName: list.getTitle(),
          };
        });
        Logger.log(res)
      }
      

      参考:

      • Google Tasks API
      • 如果这不是您想要的结果,我表示歉意.

        If this was not the result you want, I apologize.