Remarque: cet API prend en charge les autorisations d’administrateur. Les utilisateurs disposant de rôles d’administrateur peuvent accéder à des groupes dont ils ne sont pas membres.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new TimeOff
{
UserId = "c5d0c76b-80c4-481c-be50-923cd8d680a1",
SharedTimeOff = new TimeOffItem
{
TimeOffReasonId = "TOR_891045ca-b5d2-406b-aa06-a3c8921245d7",
StartDateTime = DateTimeOffset.Parse("2019-03-11T07:00:00Z"),
EndDateTime = DateTimeOffset.Parse("2019-03-12T07:00:00Z"),
Theme = ScheduleEntityTheme.White,
},
DraftTimeOff = new TimeOffItem
{
TimeOffReasonId = "TOR_891045ca-b5d2-406b-aa06-a3c8921245d7",
StartDateTime = DateTimeOffset.Parse("2019-03-11T07:00:00Z"),
EndDateTime = DateTimeOffset.Parse("2019-03-12T07:00:00Z"),
Theme = ScheduleEntityTheme.Pink,
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].Schedule.TimesOff.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TimeOff timeOff = new TimeOff();
timeOff.setUserId("c5d0c76b-80c4-481c-be50-923cd8d680a1");
TimeOffItem sharedTimeOff = new TimeOffItem();
sharedTimeOff.setTimeOffReasonId("TOR_891045ca-b5d2-406b-aa06-a3c8921245d7");
OffsetDateTime startDateTime = OffsetDateTime.parse("2019-03-11T07:00:00Z");
sharedTimeOff.setStartDateTime(startDateTime);
OffsetDateTime endDateTime = OffsetDateTime.parse("2019-03-12T07:00:00Z");
sharedTimeOff.setEndDateTime(endDateTime);
sharedTimeOff.setTheme(ScheduleEntityTheme.White);
timeOff.setSharedTimeOff(sharedTimeOff);
TimeOffItem draftTimeOff = new TimeOffItem();
draftTimeOff.setTimeOffReasonId("TOR_891045ca-b5d2-406b-aa06-a3c8921245d7");
OffsetDateTime startDateTime1 = OffsetDateTime.parse("2019-03-11T07:00:00Z");
draftTimeOff.setStartDateTime(startDateTime1);
OffsetDateTime endDateTime1 = OffsetDateTime.parse("2019-03-12T07:00:00Z");
draftTimeOff.setEndDateTime(endDateTime1);
draftTimeOff.setTheme(ScheduleEntityTheme.Pink);
timeOff.setDraftTimeOff(draftTimeOff);
TimeOff result = graphClient.teams().byTeamId("{team-id}").schedule().timesOff().post(timeOff);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.time_off import TimeOff
from msgraph.generated.models.time_off_item import TimeOffItem
from msgraph.generated.models.schedule_entity_theme import ScheduleEntityTheme
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TimeOff(
user_id = "c5d0c76b-80c4-481c-be50-923cd8d680a1",
shared_time_off = TimeOffItem(
time_off_reason_id = "TOR_891045ca-b5d2-406b-aa06-a3c8921245d7",
start_date_time = "2019-03-11T07:00:00Z",
end_date_time = "2019-03-12T07:00:00Z",
theme = ScheduleEntityTheme.White,
),
draft_time_off = TimeOffItem(
time_off_reason_id = "TOR_891045ca-b5d2-406b-aa06-a3c8921245d7",
start_date_time = "2019-03-11T07:00:00Z",
end_date_time = "2019-03-12T07:00:00Z",
theme = ScheduleEntityTheme.Pink,
),
)
result = await graph_client.teams.by_team_id('team-id').schedule.times_off.post(request_body)