Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
Das folgende Beispiel zeigt eine Anfrage.
POST https://graph.microsoft.com/beta/teams/788b75d2-a911-48c0-a5e2-dc98480457e3/schedule/openShifts
Authorization: Bearer {token}
Content-type: application/json
{
"id":"OPNSHFT_577b75d2-a927-48c0-a5d1-dc984894e7b8",
"schedulingGroupId":"TAG_228940ed-ff84-4e25-b129-1b395cf78be0",
"sharedOpenShift":{
"notes":"InventoryManagement",
"openSlotCount":2,
"displayName":"Dayshift",
"startDateTime":"2018-10-04T00: 58: 45.340Z",
"endDateTime":"2018-10-04T09: 50: 45.332Z",
"theme":"white",
"activities":[
{
"isPaid":true,
"startDateTime":"2018-10-04T00: 58: 45.340Z",
"endDateTime":"2018-10-04T01: 58: 45.340Z",
"code":"",
"displayName":"Lunch"
}
]
},
"draftOpenShift":null,
"createdDateTime":"2019-03-14T04: 32: 51.451Z",
"lastModifiedDateTime":"2019-03-14T05: 32: 51.451Z",
"lastModifiedBy":{
"application":null,
"device":null,
"conversation":null,
"user":{
"id":"366c0b19-49b1-41b5-a03f-9f3887bd0ed8",
"displayName":"JohnDoe"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new OpenShift
{
Id = "OPNSHFT_577b75d2-a927-48c0-a5d1-dc984894e7b8",
SchedulingGroupId = "TAG_228940ed-ff84-4e25-b129-1b395cf78be0",
SharedOpenShift = new OpenShiftItem
{
Notes = "InventoryManagement",
OpenSlotCount = 2,
DisplayName = "Dayshift",
StartDateTime = DateTimeOffset.Parse("2018-10-04T00: 58: 45.340Z"),
EndDateTime = DateTimeOffset.Parse("2018-10-04T09: 50: 45.332Z"),
Theme = ScheduleEntityTheme.White,
Activities = new List<ShiftActivity>
{
new ShiftActivity
{
IsPaid = true,
StartDateTime = DateTimeOffset.Parse("2018-10-04T00: 58: 45.340Z"),
EndDateTime = DateTimeOffset.Parse("2018-10-04T01: 58: 45.340Z"),
Code = "",
DisplayName = "Lunch",
},
},
},
DraftOpenShift = null,
CreatedDateTime = DateTimeOffset.Parse("2019-03-14T04: 32: 51.451Z"),
LastModifiedDateTime = DateTimeOffset.Parse("2019-03-14T05: 32: 51.451Z"),
LastModifiedBy = new IdentitySet
{
Application = null,
Device = null,
User = new Identity
{
Id = "366c0b19-49b1-41b5-a03f-9f3887bd0ed8",
DisplayName = "JohnDoe",
},
AdditionalData = new Dictionary<string, object>
{
{
"conversation" , null
},
},
},
};
// 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.OpenShifts.PostAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("Authorization", "Bearer {token}");
});
mgc-beta teams schedule open-shifts create --team-id {team-id} --body '{\
"id":"OPNSHFT_577b75d2-a927-48c0-a5d1-dc984894e7b8",\
"schedulingGroupId":"TAG_228940ed-ff84-4e25-b129-1b395cf78be0",\
"sharedOpenShift":{\
"notes":"InventoryManagement",\
"openSlotCount":2,\
"displayName":"Dayshift",\
"startDateTime":"2018-10-04T00: 58: 45.340Z",\
"endDateTime":"2018-10-04T09: 50: 45.332Z",\
"theme":"white",\
"activities":[\
{\
"isPaid":true,\
"startDateTime":"2018-10-04T00: 58: 45.340Z",\
"endDateTime":"2018-10-04T01: 58: 45.340Z",\
"code":"",\
"displayName":"Lunch"\
}\
]\
},\
"draftOpenShift":null,\
"createdDateTime":"2019-03-14T04: 32: 51.451Z",\
"lastModifiedDateTime":"2019-03-14T05: 32: 51.451Z",\
"lastModifiedBy":{\
"application":null,\
"device":null,\
"conversation":null,\
"user":{\
"id":"366c0b19-49b1-41b5-a03f-9f3887bd0ed8",\
"displayName":"JohnDoe"\
}\
}\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
"time"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
graphteams "github.com/microsoftgraph/msgraph-beta-sdk-go/teams"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("Authorization", "Bearer {token}")
configuration := &graphteams.ItemScheduleOpenShiftsRequestBuilderPostRequestConfiguration{
Headers: headers,
}
requestBody := graphmodels.NewOpenShift()
id := "OPNSHFT_577b75d2-a927-48c0-a5d1-dc984894e7b8"
requestBody.SetId(&id)
schedulingGroupId := "TAG_228940ed-ff84-4e25-b129-1b395cf78be0"
requestBody.SetSchedulingGroupId(&schedulingGroupId)
sharedOpenShift := graphmodels.NewOpenShiftItem()
notes := "InventoryManagement"
sharedOpenShift.SetNotes(¬es)
openSlotCount := int32(2)
sharedOpenShift.SetOpenSlotCount(&openSlotCount)
displayName := "Dayshift"
sharedOpenShift.SetDisplayName(&displayName)
startDateTime , err := time.Parse(time.RFC3339, "2018-10-04T00: 58: 45.340Z")
sharedOpenShift.SetStartDateTime(&startDateTime)
endDateTime , err := time.Parse(time.RFC3339, "2018-10-04T09: 50: 45.332Z")
sharedOpenShift.SetEndDateTime(&endDateTime)
theme := graphmodels.WHITE_SCHEDULEENTITYTHEME
sharedOpenShift.SetTheme(&theme)
shiftActivity := graphmodels.NewShiftActivity()
isPaid := true
shiftActivity.SetIsPaid(&isPaid)
startDateTime , err := time.Parse(time.RFC3339, "2018-10-04T00: 58: 45.340Z")
shiftActivity.SetStartDateTime(&startDateTime)
endDateTime , err := time.Parse(time.RFC3339, "2018-10-04T01: 58: 45.340Z")
shiftActivity.SetEndDateTime(&endDateTime)
code := ""
shiftActivity.SetCode(&code)
displayName := "Lunch"
shiftActivity.SetDisplayName(&displayName)
activities := []graphmodels.ShiftActivityable {
shiftActivity,
}
sharedOpenShift.SetActivities(activities)
requestBody.SetSharedOpenShift(sharedOpenShift)
draftOpenShift := null
requestBody.SetDraftOpenShift(&draftOpenShift)
createdDateTime , err := time.Parse(time.RFC3339, "2019-03-14T04: 32: 51.451Z")
requestBody.SetCreatedDateTime(&createdDateTime)
lastModifiedDateTime , err := time.Parse(time.RFC3339, "2019-03-14T05: 32: 51.451Z")
requestBody.SetLastModifiedDateTime(&lastModifiedDateTime)
lastModifiedBy := graphmodels.NewIdentitySet()
application := null
lastModifiedBy.SetApplication(&application)
device := null
lastModifiedBy.SetDevice(&device)
user := graphmodels.NewIdentity()
id := "366c0b19-49b1-41b5-a03f-9f3887bd0ed8"
user.SetId(&id)
displayName := "JohnDoe"
user.SetDisplayName(&displayName)
lastModifiedBy.SetUser(user)
additionalData := map[string]interface{}{
conversation := null
lastModifiedBy.SetConversation(&conversation)
}
lastModifiedBy.SetAdditionalData(additionalData)
requestBody.SetLastModifiedBy(lastModifiedBy)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
openShifts, err := graphClient.Teams().ByTeamId("team-id").Schedule().OpenShifts().Post(context.Background(), requestBody, configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OpenShift openShift = new OpenShift();
openShift.setId("OPNSHFT_577b75d2-a927-48c0-a5d1-dc984894e7b8");
openShift.setSchedulingGroupId("TAG_228940ed-ff84-4e25-b129-1b395cf78be0");
OpenShiftItem sharedOpenShift = new OpenShiftItem();
sharedOpenShift.setNotes("InventoryManagement");
sharedOpenShift.setOpenSlotCount(2);
sharedOpenShift.setDisplayName("Dayshift");
OffsetDateTime startDateTime = OffsetDateTime.parse("2018-10-04T00: 58: 45.340Z");
sharedOpenShift.setStartDateTime(startDateTime);
OffsetDateTime endDateTime = OffsetDateTime.parse("2018-10-04T09: 50: 45.332Z");
sharedOpenShift.setEndDateTime(endDateTime);
sharedOpenShift.setTheme(ScheduleEntityTheme.White);
LinkedList<ShiftActivity> activities = new LinkedList<ShiftActivity>();
ShiftActivity shiftActivity = new ShiftActivity();
shiftActivity.setIsPaid(true);
OffsetDateTime startDateTime1 = OffsetDateTime.parse("2018-10-04T00: 58: 45.340Z");
shiftActivity.setStartDateTime(startDateTime1);
OffsetDateTime endDateTime1 = OffsetDateTime.parse("2018-10-04T01: 58: 45.340Z");
shiftActivity.setEndDateTime(endDateTime1);
shiftActivity.setCode("");
shiftActivity.setDisplayName("Lunch");
activities.add(shiftActivity);
sharedOpenShift.setActivities(activities);
openShift.setSharedOpenShift(sharedOpenShift);
openShift.setDraftOpenShift(null);
OffsetDateTime createdDateTime = OffsetDateTime.parse("2019-03-14T04: 32: 51.451Z");
openShift.setCreatedDateTime(createdDateTime);
OffsetDateTime lastModifiedDateTime = OffsetDateTime.parse("2019-03-14T05: 32: 51.451Z");
openShift.setLastModifiedDateTime(lastModifiedDateTime);
IdentitySet lastModifiedBy = new IdentitySet();
lastModifiedBy.setApplication(null);
lastModifiedBy.setDevice(null);
Identity user = new Identity();
user.setId("366c0b19-49b1-41b5-a03f-9f3887bd0ed8");
user.setDisplayName("JohnDoe");
lastModifiedBy.setUser(user);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("conversation", null);
lastModifiedBy.setAdditionalData(additionalData);
openShift.setLastModifiedBy(lastModifiedBy);
OpenShift result = graphClient.teams().byTeamId("{team-id}").schedule().openShifts().post(openShift, requestConfiguration -> {
requestConfiguration.headers.add("Authorization", "Bearer {token}");
});
const options = {
authProvider,
};
const client = Client.init(options);
const openShift = {
id: 'OPNSHFT_577b75d2-a927-48c0-a5d1-dc984894e7b8',
schedulingGroupId: 'TAG_228940ed-ff84-4e25-b129-1b395cf78be0',
sharedOpenShift: {
notes: 'InventoryManagement',
openSlotCount: 2,
displayName: 'Dayshift',
startDateTime: '2018-10-04T00: 58: 45.340Z',
endDateTime: '2018-10-04T09: 50: 45.332Z',
theme: 'white',
activities: [
{
isPaid: true,
startDateTime: '2018-10-04T00: 58: 45.340Z',
endDateTime: '2018-10-04T01: 58: 45.340Z',
code: '',
displayName: 'Lunch'
}
]
},
draftOpenShift: null,
createdDateTime: '2019-03-14T04: 32: 51.451Z',
lastModifiedDateTime: '2019-03-14T05: 32: 51.451Z',
lastModifiedBy: {
application: null,
device: null,
conversation: null,
user: {
id: '366c0b19-49b1-41b5-a03f-9f3887bd0ed8',
displayName: 'JohnDoe'
}
}
};
await client.api('/teams/788b75d2-a911-48c0-a5e2-dc98480457e3/schedule/openShifts')
.version('beta')
.post(openShift);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Teams\Item\Schedule\OpenShifts\OpenShiftsRequestBuilderPostRequestConfiguration;
use Microsoft\Graph\Beta\Generated\Models\OpenShift;
use Microsoft\Graph\Beta\Generated\Models\OpenShiftItem;
use Microsoft\Graph\Beta\Generated\Models\ScheduleEntityTheme;
use Microsoft\Graph\Beta\Generated\Models\ShiftActivity;
use Microsoft\Graph\Beta\Generated\Models\IdentitySet;
use Microsoft\Graph\Beta\Generated\Models\Identity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OpenShift();
$requestBody->setId('OPNSHFT_577b75d2-a927-48c0-a5d1-dc984894e7b8');
$requestBody->setSchedulingGroupId('TAG_228940ed-ff84-4e25-b129-1b395cf78be0');
$sharedOpenShift = new OpenShiftItem();
$sharedOpenShift->setNotes('InventoryManagement');
$sharedOpenShift->setOpenSlotCount(2);
$sharedOpenShift->setDisplayName('Dayshift');
$sharedOpenShift->setStartDateTime(new \DateTime('2018-10-04T00: 58: 45.340Z'));
$sharedOpenShift->setEndDateTime(new \DateTime('2018-10-04T09: 50: 45.332Z'));
$sharedOpenShift->setTheme(new ScheduleEntityTheme('white'));
$activitiesShiftActivity1 = new ShiftActivity();
$activitiesShiftActivity1->setIsPaid(true);
$activitiesShiftActivity1->setStartDateTime(new \DateTime('2018-10-04T00: 58: 45.340Z'));
$activitiesShiftActivity1->setEndDateTime(new \DateTime('2018-10-04T01: 58: 45.340Z'));
$activitiesShiftActivity1->setCode('');
$activitiesShiftActivity1->setDisplayName('Lunch');
$activitiesArray []= $activitiesShiftActivity1;
$sharedOpenShift->setActivities($activitiesArray);
$requestBody->setSharedOpenShift($sharedOpenShift);
$requestBody->setDraftOpenShift(null);
$requestBody->setCreatedDateTime(new \DateTime('2019-03-14T04: 32: 51.451Z'));
$requestBody->setLastModifiedDateTime(new \DateTime('2019-03-14T05: 32: 51.451Z'));
$lastModifiedBy = new IdentitySet();
$lastModifiedBy->setApplication(null);
$lastModifiedBy->setDevice(null);
$lastModifiedByUser = new Identity();
$lastModifiedByUser->setId('366c0b19-49b1-41b5-a03f-9f3887bd0ed8');
$lastModifiedByUser->setDisplayName('JohnDoe');
$lastModifiedBy->setUser($lastModifiedByUser);
$additionalData = [
'conversation' => null,
];
$lastModifiedBy->setAdditionalData($additionalData);
$requestBody->setLastModifiedBy($lastModifiedBy);
$requestConfiguration = new OpenShiftsRequestBuilderPostRequestConfiguration();
$headers = [
'Authorization' => 'Bearer {token}',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->teams()->byTeamId('team-id')->schedule()->openShifts()->post($requestBody, $requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Teams
$params = @{
id = "OPNSHFT_577b75d2-a927-48c0-a5d1-dc984894e7b8"
schedulingGroupId = "TAG_228940ed-ff84-4e25-b129-1b395cf78be0"
sharedOpenShift = @{
notes = "InventoryManagement"
openSlotCount = 2
displayName = "Dayshift"
startDateTime = [System.DateTime]::Parse("2018-10-04T00: 58: 45.340Z")
endDateTime = [System.DateTime]::Parse("2018-10-04T09: 50: 45.332Z")
theme = "white"
activities = @(
@{
isPaid = $true
startDateTime = [System.DateTime]::Parse("2018-10-04T00: 58: 45.340Z")
endDateTime = [System.DateTime]::Parse("2018-10-04T01: 58: 45.340Z")
code = ""
displayName = "Lunch"
}
)
}
draftOpenShift = $null
createdDateTime = [System.DateTime]::Parse("2019-03-14T04: 32: 51.451Z")
lastModifiedDateTime = [System.DateTime]::Parse("2019-03-14T05: 32: 51.451Z")
lastModifiedBy = @{
application = $null
device = $null
conversation = $null
user = @{
id = "366c0b19-49b1-41b5-a03f-9f3887bd0ed8"
displayName = "JohnDoe"
}
}
}
New-MgBetaTeamScheduleOpenShift -TeamId $teamId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.teams.item.schedule.open_shifts.open_shifts_request_builder import OpenShiftsRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph_beta.generated.models.open_shift import OpenShift
from msgraph_beta.generated.models.open_shift_item import OpenShiftItem
from msgraph_beta.generated.models.schedule_entity_theme import ScheduleEntityTheme
from msgraph_beta.generated.models.shift_activity import ShiftActivity
from msgraph_beta.generated.models.identity_set import IdentitySet
from msgraph_beta.generated.models.identity import Identity
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OpenShift(
id = "OPNSHFT_577b75d2-a927-48c0-a5d1-dc984894e7b8",
scheduling_group_id = "TAG_228940ed-ff84-4e25-b129-1b395cf78be0",
shared_open_shift = OpenShiftItem(
notes = "InventoryManagement",
open_slot_count = 2,
display_name = "Dayshift",
start_date_time = "2018-10-04T00: 58: 45.340Z",
end_date_time = "2018-10-04T09: 50: 45.332Z",
theme = ScheduleEntityTheme.White,
activities = [
ShiftActivity(
is_paid = True,
start_date_time = "2018-10-04T00: 58: 45.340Z",
end_date_time = "2018-10-04T01: 58: 45.340Z",
code = "",
display_name = "Lunch",
),
],
),
draft_open_shift = None,
created_date_time = "2019-03-14T04: 32: 51.451Z",
last_modified_date_time = "2019-03-14T05: 32: 51.451Z",
last_modified_by = IdentitySet(
application = None,
device = None,
user = Identity(
id = "366c0b19-49b1-41b5-a03f-9f3887bd0ed8",
display_name = "JohnDoe",
),
additional_data = {
"conversation" : None,
}
),
)
request_configuration = RequestConfiguration()
request_configuration.headers.add("Authorization", "Bearer {token}")
result = await graph_client.teams.by_team_id('team-id').schedule.open_shifts.post(request_body, request_configuration = request_configuration)
Das folgende Beispiel zeigt die Antwort.