Upravit

Sdílet prostřednictvím


outlookTask: complete (deprecated)

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.

Caution

The Outlook tasks API is deprecated and stopped returning data on August 20, 2022. Use the To Do API instead.

Complete an Outlook task which sets the completedDateTime property to the current date, and the status property to completed.

If you are completing a task in a recurring series, in the response, the task collection will contain the completed task in the series, and the next task in the series.

The completedDateTime property represents the date when the task is finished. The time portion of completedDateTime is set to midnight UTC by default.

By default, this operation (and the POST, GET, and PATCH task operations) returns date-related properties in UTC. You can use the Prefer: outlook.timezone header to have all the date-related properties in the response represented in a time zone different than UTC.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Tasks.ReadWrite Not available.
Delegated (personal Microsoft account) Tasks.ReadWrite Not available.
Application Not supported. Not supported.

HTTP request

POST /me/outlook/tasks/{id}/complete
POST /users/{id|userPrincipalName}/outlook/tasks/{id}/complete

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Prefer: outlook.timezone Specifies the time zone for time properties in the response, which would be in UTC if this header is not specified. Optional.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns 200 OK response code and the outlookTask object in the response body.

Example

The following example marks the specified task as complete. It specifies Pacific Standard Time (PST) in the Prefer: outlook.timezone header.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/me/outlook/tasks/AAMkADA1MT15rfAAA=/complete
Prefer: outlook.timezone="Pacific Standard Time"

Response

The following example shows the response. The completedDateTime and other date-related properties in the response are expressed in PST.

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

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "AAMkADA1MT15rfAAA=",
      "createdDateTime": "2016-04-21T22:44:01.2012012-07:00",
      "lastModifiedDateTime": "2016-04-22T19:28:38.5300447-07:00",
      "changeKey": "1/KC9Vmu40G3DwB6Lgs7MAAAIW9XYQ==",
      "categories": [
      ],
      "assignedTo": null,
      "body": {
          "contentType": "text",
          "content": ""
      },
      "completedDateTime": {
          "dateTime": "2016-04-22T00:00:00.0000000",
          "timeZone": "Pacific Standard Time"
      },
      "dueDateTime": {
          "dateTime": "2016-04-25T00:00:00.0000000",
          "timeZone": "Pacific Standard Time"
      },
      "hasAttachments":false,
      "importance": "normal",
      "isReminderOn": false,
      "owner": "Administrator",
      "parentFolderId": "AQMkADA1MTIBEgAAAA==",
      "recurrence": null,
      "reminderDateTime": null,
      "sensitivity": "normal",
      "startDateTime": {
          "dateTime": "2016-04-21T00:00:00.0000000",
          "timeZone": "Pacific Standard Time"
      },
      "status": "completed",
      "subject": "Shop for dinner"
    }
  ]
}