Выберите разрешение или разрешения, помеченные как наименее привилегированные для этого API. Используйте более привилегированное разрешение или разрешения только в том случае, если это требуется приложению. Дополнительные сведения о делегированных разрешениях и разрешениях приложений см. в разделе Типы разрешений. Дополнительные сведения об этих разрешениях см. в справочнике по разрешениям.
Тип разрешения
Разрешения с наименьшими привилегиями
Более высокие привилегированные разрешения
Делегированные (рабочая или учебная учетная запись)
Schedule.ReadWrite.All
Group.ReadWrite.All
Делегированные (личная учетная запись Майкрософт)
Не поддерживается.
Не поддерживается.
Приложение
Schedule.ReadWrite.All
Недоступно.
Примечание. Этот API поддерживает разрешения администратора. Пользователи с ролями администратора могут получать доступ к группам, членом которых они не являются.
Идентификатор пользователя (GUID). Требуется только в том случае, если маркер авторизации является маркером приложения; В противном случае — необязательно.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new TimeOffReason
{
DisplayName = "Vacation",
IconType = TimeOffReasonIconType.Plane,
IsActive = true,
AdditionalData = new Dictionary<string, object>
{
{
"code" , "VacationCode"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].Schedule.TimeOffReasons.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTimeOffReason()
displayName := "Vacation"
requestBody.SetDisplayName(&displayName)
iconType := graphmodels.PLANE_TIMEOFFREASONICONTYPE
requestBody.SetIconType(&iconType)
isActive := true
requestBody.SetIsActive(&isActive)
additionalData := map[string]interface{}{
"code" : "VacationCode",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
timeOffReasons, err := graphClient.Teams().ByTeamId("team-id").Schedule().TimeOffReasons().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TimeOffReason timeOffReason = new TimeOffReason();
timeOffReason.setDisplayName("Vacation");
timeOffReason.setIconType(TimeOffReasonIconType.Plane);
timeOffReason.setIsActive(true);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("code", "VacationCode");
timeOffReason.setAdditionalData(additionalData);
TimeOffReason result = graphClient.teams().byTeamId("{team-id}").schedule().timeOffReasons().post(timeOffReason);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.time_off_reason import TimeOffReason
from msgraph.generated.models.time_off_reason_icon_type import TimeOffReasonIconType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TimeOffReason(
display_name = "Vacation",
icon_type = TimeOffReasonIconType.Plane,
is_active = True,
additional_data = {
"code" : "VacationCode",
}
)
result = await graph_client.teams.by_team_id('team-id').schedule.time_off_reasons.post(request_body)