Skip to content

Latest commit

 

History

History
179 lines (146 loc) · 5.49 KB

File metadata and controls

179 lines (146 loc) · 5.49 KB
title Create timeCard
description Create a timeCard instance in the schedule.
author lemike
ms.date 01/17/2025
ms.localizationpriority medium
ms.subservice teams
doc_type apiPageType

Create timeCard

Namespace: microsoft.graph

Create a timeCard instance in a schedule.

[!INCLUDE national-cloud-support]

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.

[!INCLUDE permissions-table]

Important

When you use the Schedule.ReadWrite.All application permission, you must include the MS-APP-ACTS-AS header in the request.

HTTP request

POST /teams/{teamsId}/schedule/timeCards

Request headers

Header Value
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-type application/json. Required.
MS-APP-ACTS-AS The ID of the user on behalf of whom the app is acting. Required when you use the application permission scope.

Request body

Provide the new timeCard object in the request body for this method.

Response

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

Example

Request

The following example shows a request.

POST https://graph.microsoft.com/v1.0/teams/871dbd5c-3a6a-4392-bfe1-042452793a50/schedule/timeCards
Content-Type: application/json

{
  "clockInEvent": {
    "dateTime": "2025-01-07T21:00:00.000Z",
    "isAtApprovedLocation": true,
    "notes": {
      "content": "Started late due to traffic in CA 237",
      "contentType": "text"
    }
  },
  "clockOutEvent": {
    "dateTime": "2025-01-07T21:30:00.000Z",
    "isAtApprovedLocation": true
  }
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

The following example shows the response.

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

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

{
  "id": "TCK_18aeaf79-71c3-44a5-8a6c-236d25d0f726",
  "createdDateTime": "2025-01-07T21:30:20.487Z",
  "lastModifiedDateTime": "2025-01-07T21:30:20.487Z",
  "userId": "d56f3e8a-2b0f-42b1-88b9-e2dbd12a34d2",
  "state": "clockedOut",
  "confirmedBy": "none",
  "notes": null,
  "lastModifiedBy": {
    "application": null,
    "device": null,
    "user": {
      "id": "d56f3e8a-2b0f-42b1-88b9-e2dbd12a34d2",
      "displayName": "Alice Bradford"
    }
  },
  "clockInEvent": {
    "dateTime": "2025-01-07T21:00:00Z",
    "isAtApprovedLocation": true,
    "notes": {
      "contentType": "text",
      "content": "Started late due to traffic in CA 237"
    }
  },
  "clockOutEvent": {
    "dateTime": "2025-01-07T21:30:00Z",
    "isAtApprovedLocation": true,
    "notes": null
  },
  "breaks": [],
  "originalEntry": {
    "clockInEvent": null,
    "clockOutEvent": null,
    "breaks": []
  },
  "createdBy": {
    "application": null,
    "device": null,
    "user": {
      "id": "d56f3e8a-2b0f-42b1-88b9-e2dbd12a34d2",
      "displayName": "Alice Bradford"
    }
  }
}