我在哪里可以找到任务列表ID [英] Where do I find the tasklist ID

查看:58
本文介绍了我在哪里可以找到任务列表ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Google App脚本编辑器在任务列表中创建任务.看来我需要任务列表的ID才能添加任务.

I am trying to create tasks in a tasklist from the google app script editor. Looks like I need the id of the tasklist to be able to add the task.

问题是我可以找出ti在哪里找到任务列表ID

Problem is I can figure out where ti find the tasklist ID

推荐答案

如果要使用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.

        这篇关于我在哪里可以找到任务列表ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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