googleworkspace / googleworkspace/apps-script-samples

Completed Tasks are not returned

Open
#379 1 comment 0 reactions 1 assignee View on GitHub

@vinay-google is already working on this.

Since Jan 27, 2023.

Dominant language
JavaScript
Stars
5.2k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

Summary

function listTasks(taskListId) {
  try {
    // List the task items of specified tasklist using taskList id.
    const tasks = Tasks.Tasks.list(taskListId);
    // Tasks.Tasks.list({tasklist: tasklistId, showCompleted: true, completedMin: '1970-01-01T00:00:00Z'});
    // If tasks are available then print all task of given tasklists.
    if (!tasks.items) {
      console.log('No tasks found.');
      return;
    }
    // Print the task title and task id of specified tasklist.
    for (let i = 0; i < tasks.items.length; i++) {
      const task = tasks.items[i];
      console.log('Task with title "%s" and ID "%s" was found.', task.title, task.id);
    }
  } catch (err) {
    // TODO (developer) - Handle exception from Task API
    console.log('Failed with an error %s', err.message);
  }
}

Expected Behavior

Logging all the tasks

Actual Behavior

It only returns the uncompleted tasks. I want to return all the tasks of a list.

Steps to Reproduce the Problem

Just run it in Google Apps Scripts with the list ID.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.