Create todoTask

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Create a new task object in a specified todoTaskList.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from most to least privileged)
Delegated (work or school account) Tasks.ReadWrite
Delegated (personal Microsoft account) Tasks.ReadWrite
Application Not supported.

HTTP request

POST /me/todo/lists/{todoTaskListId}/tasks
POST /users/{id|userPrincipalName}/todo/lists/{todoTaskListId}/tasks

Request headers

Name Description
Authorization Bearer {token}. Required.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of the todoTask object.

The following table shows the properties that are required when you create the todoTask.

Property Type Description
id String Unique identifier for the task. By default, this value changes when the item is moved from one list to another.
body itemBody The task body that typically contains information about the task.
completedDateTime dateTimeTimeZone The date in the specified time zone that the task was finished.
dueDateTime dateTimeTimeZone The date in the specified time zone that the task is to be finished.
importance importance The importance of the task. Possible values are: low, normal, high.
isReminderOn Boolean Set to true if an alert is set to remind the user of the task.
recurrence patternedRecurrence The recurrence pattern for the task.
reminderDateTime dateTimeTimeZone The date and time for a reminder alert of the task to occur.
status taskStatus Indicates the state or progress of the task. Possible values are: notStarted, inProgress, completed, waitingOnOthers, deferred.
title String A brief description of the task.
createdDateTime DateTimeOffset The date and time when the task was created. By default, it is in UTC. You can provide a custom time zone in the request header. The property value uses ISO 8601 format. For example, midnight UTC on Jan 1, 2020 would look like this: '2020-01-01T00:00:00Z'.
lastModifiedDateTime DateTimeOffset The date and time when the task was last modified. By default, it is in UTC. You can provide a custom time zone in the request header. The property value uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2020 would look like this: '2020-01-01T00:00:00Z'.
bodyLastModifiedDateTime DateTimeOffset The date and time when the task was last modified. By default, it is in UTC. You can provide a custom time zone in the request header. The property value uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2020 would look like this: '2020-01-01T00:00:00Z'.

Response

If successful, this method returns a 201 Created response code and a todoTask object in the response body.

Examples

Request

POST https://graph.microsoft.com/beta/me/todo/lists/AQMkADAwATM0MDAAMS0yMDkyLWVjMzYtM/tasks
Content-Type: application/json
Content-length: 608

{
  "title":"A new task",
  "linkedResources": [{
			"webUrl": "http://microsoft.com",
			"applicationName": "Microsoft",
			"displayName": "Microsoft"
		}]
}

Response

Note: The response object shown here might be shortened for readability.

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.etag": "W/\"xzyPKP0BiUGgld+lMKXwbQAAnBoTIw==\"",
    "importance": "low",
    "isReminderOn": false,
    "status": "notStarted",
    "title": "A new task",
    "createdDateTime": "2020-08-18T09:03:05.8339192Z",
    "lastModifiedDateTime": "2020-08-18T09:03:06.0827766Z",
    "id": "AlMKXwbQAAAJws6wcAAAA=",
    "body": {
        "content": "",
        "contentType": "text"
    },
    "linkedResources": [{
      "id": "f9cddce2-dce2-f9cd-e2dc-cdf9e2dccdf9",
			"webUrl": "http://microsoft.com",
			"applicationName": "Microsoft",
			"displayName": "Microsoft"
		}]
}