team: getTimesOff
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.
Get all time off objects across all teams to which a user is a direct member.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | Schedule.Read.All | Schedule.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | Schedule.Read.All | Schedule.ReadWrite.All |
HTTP request
GET /me/joinedTeams/getTimesOff
GET /users/{id | user-principal-name}/joinedTeams/getTimesOff
Optional query parameters
This method supports the $top
, $orderby
, $select
and $filter
OData query parameters to help customize the response.
Note
The $filter
parameter supports the sharedTimeOff/startDateTime, sharedTimeOff/endDateTime, userID and teamInfo/teamId properties. It doesn't support the use of the same property more than once in a query. For example, the following query doesn't work: sharedTimeOff/startDateTime ge 2024-05-09T00:00:00Z and sharedTimeOff/startDateTime le 2024-05-09T23:59:59Z
; however, the following query works: sharedTimeOff/startDateTime ge 2024-05-09T00:00:00Z and sharedTimeOff/endDateTime le 2024-05-09T23:59:59Z
.
Request headers
Name | Description |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
MS-APP-ACTS-AS | A user ID (GUID). Required only if the authorization token is an application token; otherwise, optional. |
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a collection of time off objects in the response body.
Examples
Request
The following example shows a request.
GET https://graph.microsoft.com/beta/me/joinedTeams/getTimesOff
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"userId": "c5d0c76b-80c4-481c-be50-923cd8d680a1",
"teamInfo": {
"displayName": "Contoso Team",
"teamId": "172b0cce-e65d-44ce-9a49-91d9f2e8493a"
},
"userInfo": {
"displayName": "John Smith",
"teamId": "c5d0c76b-80c4-481c-be50-923cd8d680a1"
},
"createdDateTime": "2019-03-14T05:35:57.755Z",
"lastModifiedDateTime": "2019-03-14T05:36:08.381Z",
"lastModifiedBy": {
"application": null,
"device": null,
"conversation": null,
"user": {
"id": "366c0b19-49b1-41b5-a03f-9f3887bd0ed8",
"displayName": "John Doe"
}
},
"sharedTimeOff": {
"timeOffReasonId": "TOR_891045ca-b5d2-406b-aa06-a3c8921245d7",
"startDateTime": "2019-03-11T07:00:00Z",
"endDateTime": "2019-03-12T07:00:00Z",
"theme": "white"
},
"draftTimeOff": {
"timeOffReasonId": "TOR_891045ca-b5d2-406b-aa06-a3c8921245d7",
"startDateTime": "2019-03-11T07:00:00Z",
"endDateTime": "2019-03-12T07:00:00Z",
"theme": "pink"
}
}
]
}