Note: This API supports admin permissions. Global admins can access groups that they are not a member of.
HTTP request
GET /teams/{teamId}/schedule/timesOff
Optional query parameters
This method supports the $filterOData query parameter to help customize the response.
Request headers
Header
Value
Authorization
Bearer {token}. Required.
MS-APP-ACTS-AS
A user ID (GUID). Required only if the authorization token is an application token; otherwise, optional.
Request body
Do not supply a request body for this method.
Response
If successful, this method returns a 200 OK response code and a collection of timeOff objects in the response body.
Example
Request
The following is an example of a request that gets all timeOff objects that have a shared version and a draft version between March 11 - March 18, 2019.
GET https://graph.microsoft.com/v1.0/teams/{teamId}/schedule/timesOff?$filter=sharedTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and sharedTimeOff/endDateTime le 2019-03-18T00:00:00.000Z and draftTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and draftTimeOff/endDateTime le 2019-03-18T00:00:00.000Z
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var result = await graphClient.Teams["{team-id}"].Schedule.TimesOff.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "sharedTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and sharedTimeOff/endDateTime le 2019-03-18T00:00:00.000Z and draftTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and draftTimeOff/endDateTime le 2019-03-18T00:00:00.000Z";
});
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc teams schedule times-off list --team-id {team-id} --filter "sharedTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and sharedTimeOff/endDateTime le 2019-03-18T00:00:00.000Z and draftTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and draftTimeOff/endDateTime le 2019-03-18T00:00:00.000Z"
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
TimeOffCollectionPage timesOff = graphClient.teams("{teamId}").schedule().timesOff()
.buildRequest()
.filter("sharedTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and sharedTimeOff/endDateTime le 2019-03-18T00:00:00.000Z and draftTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and draftTimeOff/endDateTime le 2019-03-18T00:00:00.000Z")
.get();
const options = {
authProvider,
};
const client = Client.init(options);
let timesOff = await client.api('/teams/{teamId}/schedule/timesOff')
.filter('sharedTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and sharedTimeOff/endDateTime le 2019-03-18T00:00:00.000Z and draftTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and draftTimeOff/endDateTime le 2019-03-18T00:00:00.000Z')
.get();
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new TimesOffRequestBuilderGetRequestConfiguration();
$queryParameters = TimesOffRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "sharedTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and sharedTimeOff/endDateTime le 2019-03-18T00:00:00.000Z and draftTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and draftTimeOff/endDateTime le 2019-03-18T00:00:00.000Z";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->teams()->byTeamId('team-id')->schedule()->timesOff()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Teams
Get-MgTeamScheduleTimeOff -TeamId $teamId -Filter "sharedTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and sharedTimeOff/endDateTime le 2019-03-18T00:00:00.000Z and draftTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and draftTimeOff/endDateTime le 2019-03-18T00:00:00.000Z"
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(request_adapter)
query_params = TimesOffRequestBuilder.TimesOffRequestBuilderGetQueryParameters(
filter = "sharedTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and sharedTimeOff/endDateTime le 2019-03-18T00:00:00.000Z and draftTimeOff/startDateTime ge 2019-03-11T00:00:00.000Z and draftTimeOff/endDateTime le 2019-03-18T00:00:00.000Z",
)
request_configuration = TimesOffRequestBuilder.TimesOffRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.teams.by_team_id('team-id').schedule.time_off.get(request_configuration = request_configuration)