Script integration with Microsoft To Do. This object handles OAuth authentication and request signing. The entire Microsoft To Do Graph API can be used with the request method, and convenience methods are provided for common API endpoints to manage tasks and lists.

Working with the return values and parameters for these methods requires an understanding of the JSON objects created and returned by the API, so refer to type specifications in the API Reference for details on values supported in task and lists. Specifically, review the supported properties of the Task and TaskList objects to understand the values included in fetched objects, and to make modifications.

If an API calls fails, typically the result will be an undefined value, and the lastError property will contains error detail information for troubleshooting.

Example

See Examples-Microsoft To Do action group in the Drafts Directory. It contains several example scripted actions.

// create MicrosoftToDo object
let todo = MicrosoftToDo.create();
// create task in "Test" list
let list = todo.findList("Test");
// create task object, more properties available, see API docs
let task = {
"title": `Task Title`,
"importance": "high",
"body": {
"content": "Notes for the task",
"contentType": "text"
};
"dueDateTime": {
"dateTime": Date.today().addDays(1).toISOString(),
"timeZone": "UTC"
}
};
let t = todo.createTask(list, task);

Hierarchy

  • MicrosoftToDo

Linked Resource

  • Create new linked resource for a task. A linked resource is a reference to content in an external system, such as a link back to a draft. API documentation

    Parameters

    • list: object
    • task: object
    • linkedResource: object

    Returns object

Lists

  • Create list by name.

    Parameters

    • name: string

    Returns object

  • Get specific list by name. This is a convenience method which will fetch lists and return the first one found with a matching name.

    Parameters

    • name: string

    Returns object

Other

lastError?: string

If a function fails, this property will contain the last error as a string message, otherwise it will be undefined.

lastResponse: any

If a function succeeds, this property will contain the last response returned by the To Do API. The JSON returned by the API will be parsed to an object and placed in this property. Refer to To Do API documentation for details on the contents of this object based on call made.

  • Execute a request against the Microsoft To Do API. For successful requests, the HTTPResponse object will contain an object or array or objects decoded from the JSON returned by the API as appropriate to the request made. Refer to API documentation for details about the expected parameters and responses. Drafts will handle wrapping the request in the appropriate OAuth authentication flow. Requests should only be made to endpoints in the Microsoft Graph API which require the Task.ReadWrite authentication scope.

    Parameters

    • settings: {
          data?: {
              [x: string]: string;
          };
          headers?: {
              [x: string]: string;
          };
          method: string;
          parameters?: {
              [x: string]: string;
          };
          url: string;
      }

      an object configuring the request.

      • Optional data?: {
            [x: string]: string;
        }

        A JavaScript object containing data to be encoded into the HTTP body of the request.

        • [x: string]: string
      • Optional headers?: {
            [x: string]: string;
        }

        An object contain key-values to be added as custom headers in the request. There is no need to provide authorization headers, Drafts will add those.

        • [x: string]: string
      • method: string

        The HTTP method, like "GET", "POST", "PATCH", etc.

      • Optional parameters?: {
            [x: string]: string;
        }

        An object containing key-values to be added to the request as URL parameters.

        • [x: string]: string
      • url: string

        The full URL to the endpoint in the To Do API.

    Returns HTTPResponse

  • Creates a new MicrosoftToDo object.

    Parameters

    • identifier: string

      Optional string value used to identify a To Do account. Typically this can be omitted if you only work with one To Do account in Drafts. Each unique identifier used for To Do accounts will share credentials - across both action steps and scripts.

    Returns MicrosoftToDo

Tasks

  • Create new task in the specified list. API documentation

    Parameters

    • list: object
    • task: object

    Returns object

  • Get a specific task by ID. API documentation

    Parameters

    • list: object
    • taskID: String

    Returns object

  • Get tasks in a list. API documentation

    Parameters

    • list: object

    Returns object[]

  • Update an existing task. Typical usage would be to modify the contents of a task returned by getTask or getTasks and sending the modified version as an update API documentation

    Parameters

    • list: object
    • task: object

    Returns object

Generated using TypeDoc