Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie im Artikel zum Thema Berechtigungen.
Geben Sie im Anforderungstext die Werte für die relevanten Felder an, die aktualisiert werden sollen. Vorhandene Eigenschaften, die nicht im Anforderungstext enthalten sind, behalten ihre vorherigen Werte oder werden basierend auf Änderungen an anderen Eigenschaftswerten neu berechnet. Geben Sie aus Gründen der Leistung vorhandene Werte, die nicht geändert wurden, nicht an.
Im folgenden Beispiel wird der Zeitplan des Mitarbeiters so geändert, dass montags deaktiviert ist.
PATCH https://graph.microsoft.com/beta/bookingBusinesses/Contosolunchdelivery@contoso.onmicrosoft.com/staffmembers/8ee1c803-a1fa-406d-8259-7ab53233f148
Content-type: application/json
{
"workingHours":[
{
"@odata.type":"#microsoft.graph.bookingWorkHours",
"day@odata.type":"#microsoft.graph.dayOfWeek",
"day":"monday",
"timeSlots@odata.type":"#Collection(microsoft.graph.bookingWorkTimeSlot)",
"timeSlots":[
]
},
{
"@odata.type":"#microsoft.graph.bookingWorkHours",
"day@odata.type":"#microsoft.graph.dayOfWeek",
"day":"tuesday",
"timeSlots@odata.type":"#Collection(microsoft.graph.bookingWorkTimeSlot)",
"timeSlots":[
{
"@odata.type":"#microsoft.graph.bookingWorkTimeSlot",
"end":"17:00:00.0000000",
"start":"08:00:00.0000000"
}
]
},
{
"@odata.type":"#microsoft.graph.bookingWorkHours",
"day@odata.type":"#microsoft.graph.dayOfWeek",
"day":"wednesday",
"timeSlots@odata.type":"#Collection(microsoft.graph.bookingWorkTimeSlot)",
"timeSlots":[
{
"@odata.type":"#microsoft.graph.bookingWorkTimeSlot",
"end":"17:00:00.0000000",
"start":"08:00:00.0000000"
}
]
},
{
"@odata.type":"#microsoft.graph.bookingWorkHours",
"day@odata.type":"#microsoft.graph.dayOfWeek",
"day":"thursday",
"timeSlots@odata.type":"#Collection(microsoft.graph.bookingWorkTimeSlot)",
"timeSlots":[
{
"@odata.type":"#microsoft.graph.bookingWorkTimeSlot",
"end":"17:00:00.0000000",
"start":"08:00:00.0000000"
}
]
},
{
"@odata.type":"#microsoft.graph.bookingWorkHours",
"day@odata.type":"#microsoft.graph.dayOfWeek",
"day":"friday",
"timeSlots@odata.type":"#Collection(microsoft.graph.bookingWorkTimeSlot)",
"timeSlots":[
{
"@odata.type":"#microsoft.graph.bookingWorkTimeSlot",
"end":"17:00:00.0000000",
"start":"08:00:00.0000000"
}
]
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var bookingStaffMember = new BookingStaffMember
{
WorkingHours = new List<BookingWorkHours>()
{
new BookingWorkHours
{
Day = DayOfWeek.Monday,
TimeSlots = new List<BookingWorkTimeSlot>()
{
},
AdditionalData = new Dictionary<string, object>()
{
{"day@odata.type", "#microsoft.graph.dayOfWeek"},
{"timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)"}
}
},
new BookingWorkHours
{
Day = DayOfWeek.Tuesday,
TimeSlots = new List<BookingWorkTimeSlot>()
{
new BookingWorkTimeSlot
{
End = new TimeOfDay(17, 0, 0),
Start = new TimeOfDay(8, 0, 0)
}
},
AdditionalData = new Dictionary<string, object>()
{
{"day@odata.type", "#microsoft.graph.dayOfWeek"},
{"timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)"}
}
},
new BookingWorkHours
{
Day = DayOfWeek.Wednesday,
TimeSlots = new List<BookingWorkTimeSlot>()
{
new BookingWorkTimeSlot
{
End = new TimeOfDay(17, 0, 0),
Start = new TimeOfDay(8, 0, 0)
}
},
AdditionalData = new Dictionary<string, object>()
{
{"day@odata.type", "#microsoft.graph.dayOfWeek"},
{"timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)"}
}
},
new BookingWorkHours
{
Day = DayOfWeek.Thursday,
TimeSlots = new List<BookingWorkTimeSlot>()
{
new BookingWorkTimeSlot
{
End = new TimeOfDay(17, 0, 0),
Start = new TimeOfDay(8, 0, 0)
}
},
AdditionalData = new Dictionary<string, object>()
{
{"day@odata.type", "#microsoft.graph.dayOfWeek"},
{"timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)"}
}
},
new BookingWorkHours
{
Day = DayOfWeek.Friday,
TimeSlots = new List<BookingWorkTimeSlot>()
{
new BookingWorkTimeSlot
{
End = new TimeOfDay(17, 0, 0),
Start = new TimeOfDay(8, 0, 0)
}
},
AdditionalData = new Dictionary<string, object>()
{
{"day@odata.type", "#microsoft.graph.dayOfWeek"},
{"timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)"}
}
}
}
};
await graphClient.BookingBusinesses["{bookingBusiness-id}"].StaffMembers["{bookingStaffMember-id}"]
.Request()
.UpdateAsync(bookingStaffMember);
const options = {
authProvider,
};
const client = Client.init(options);
const bookingStaffMember = {
workingHours: [
{
'@odata.type':'#microsoft.graph.bookingWorkHours',
'day@odata.type':'#microsoft.graph.dayOfWeek',
day: 'monday',
'timeSlots@odata.type':'#Collection(microsoft.graph.bookingWorkTimeSlot)',
timeSlots: [
]
},
{
'@odata.type':'#microsoft.graph.bookingWorkHours',
'day@odata.type':'#microsoft.graph.dayOfWeek',
day: 'tuesday',
'timeSlots@odata.type':'#Collection(microsoft.graph.bookingWorkTimeSlot)',
timeSlots: [
{
'@odata.type':'#microsoft.graph.bookingWorkTimeSlot',
end: '17:00:00.0000000',
start: '08:00:00.0000000'
}
]
},
{
'@odata.type':'#microsoft.graph.bookingWorkHours',
'day@odata.type':'#microsoft.graph.dayOfWeek',
day: 'wednesday',
'timeSlots@odata.type':'#Collection(microsoft.graph.bookingWorkTimeSlot)',
timeSlots: [
{
'@odata.type':'#microsoft.graph.bookingWorkTimeSlot',
end: '17:00:00.0000000',
start: '08:00:00.0000000'
}
]
},
{
'@odata.type':'#microsoft.graph.bookingWorkHours',
'day@odata.type':'#microsoft.graph.dayOfWeek',
day: 'thursday',
'timeSlots@odata.type':'#Collection(microsoft.graph.bookingWorkTimeSlot)',
timeSlots: [
{
'@odata.type':'#microsoft.graph.bookingWorkTimeSlot',
end: '17:00:00.0000000',
start: '08:00:00.0000000'
}
]
},
{
'@odata.type':'#microsoft.graph.bookingWorkHours',
'day@odata.type':'#microsoft.graph.dayOfWeek',
day: 'friday',
'timeSlots@odata.type':'#Collection(microsoft.graph.bookingWorkTimeSlot)',
timeSlots: [
{
'@odata.type':'#microsoft.graph.bookingWorkTimeSlot',
end: '17:00:00.0000000',
start: '08:00:00.0000000'
}
]
}
]
};
await client.api('/bookingBusinesses/Contosolunchdelivery@contoso.onmicrosoft.com/staffmembers/8ee1c803-a1fa-406d-8259-7ab53233f148')
.version('beta')
.update(bookingStaffMember);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/bookingBusinesses/Contosolunchdelivery@contoso.onmicrosoft.com/staffmembers/8ee1c803-a1fa-406d-8259-7ab53233f148"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphBookingStaffMember *bookingStaffMember = [[MSGraphBookingStaffMember alloc] init];
NSMutableArray *workingHoursList = [[NSMutableArray alloc] init];
MSGraphBookingWorkHours *workingHours = [[MSGraphBookingWorkHours alloc] init];
[workingHours setDay: [MSGraphDayOfWeek monday]];
NSMutableArray *timeSlotsList = [[NSMutableArray alloc] init];
[workingHours setTimeSlots:timeSlotsList];
[workingHoursList addObject: workingHours];
MSGraphBookingWorkHours *workingHours = [[MSGraphBookingWorkHours alloc] init];
[workingHours setDay: [MSGraphDayOfWeek tuesday]];
NSMutableArray *timeSlotsList = [[NSMutableArray alloc] init];
MSGraphBookingWorkTimeSlot *timeSlots = [[MSGraphBookingWorkTimeSlot alloc] init];
[timeSlots setEnd:@"17:00:00.0000000"];
[timeSlots setStart:@"08:00:00.0000000"];
[timeSlotsList addObject: timeSlots];
[workingHours setTimeSlots:timeSlotsList];
[workingHoursList addObject: workingHours];
MSGraphBookingWorkHours *workingHours = [[MSGraphBookingWorkHours alloc] init];
[workingHours setDay: [MSGraphDayOfWeek wednesday]];
NSMutableArray *timeSlotsList = [[NSMutableArray alloc] init];
MSGraphBookingWorkTimeSlot *timeSlots = [[MSGraphBookingWorkTimeSlot alloc] init];
[timeSlots setEnd:@"17:00:00.0000000"];
[timeSlots setStart:@"08:00:00.0000000"];
[timeSlotsList addObject: timeSlots];
[workingHours setTimeSlots:timeSlotsList];
[workingHoursList addObject: workingHours];
MSGraphBookingWorkHours *workingHours = [[MSGraphBookingWorkHours alloc] init];
[workingHours setDay: [MSGraphDayOfWeek thursday]];
NSMutableArray *timeSlotsList = [[NSMutableArray alloc] init];
MSGraphBookingWorkTimeSlot *timeSlots = [[MSGraphBookingWorkTimeSlot alloc] init];
[timeSlots setEnd:@"17:00:00.0000000"];
[timeSlots setStart:@"08:00:00.0000000"];
[timeSlotsList addObject: timeSlots];
[workingHours setTimeSlots:timeSlotsList];
[workingHoursList addObject: workingHours];
MSGraphBookingWorkHours *workingHours = [[MSGraphBookingWorkHours alloc] init];
[workingHours setDay: [MSGraphDayOfWeek friday]];
NSMutableArray *timeSlotsList = [[NSMutableArray alloc] init];
MSGraphBookingWorkTimeSlot *timeSlots = [[MSGraphBookingWorkTimeSlot alloc] init];
[timeSlots setEnd:@"17:00:00.0000000"];
[timeSlots setStart:@"08:00:00.0000000"];
[timeSlotsList addObject: timeSlots];
[workingHours setTimeSlots:timeSlotsList];
[workingHoursList addObject: workingHours];
[bookingStaffMember setWorkingHours:workingHoursList];
NSError *error;
NSData *bookingStaffMemberData = [bookingStaffMember getSerializedDataWithError:&error];
[urlRequest setHTTPBody:bookingStaffMemberData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
BookingStaffMember bookingStaffMember = new BookingStaffMember();
LinkedList<BookingWorkHours> workingHoursList = new LinkedList<BookingWorkHours>();
BookingWorkHours workingHours = new BookingWorkHours();
workingHours.additionalDataManager().put("day@odata.type", new JsonPrimitive("#microsoft.graph.dayOfWeek"));
workingHours.day = DayOfWeek.MONDAY;
workingHours.additionalDataManager().put("timeSlots@odata.type", new JsonPrimitive("#Collection(microsoft.graph.bookingWorkTimeSlot)"));
LinkedList<BookingWorkTimeSlot> timeSlotsList = new LinkedList<BookingWorkTimeSlot>();
workingHours.timeSlots = timeSlotsList;
workingHoursList.add(workingHours);
BookingWorkHours workingHours1 = new BookingWorkHours();
workingHours1.additionalDataManager().put("day@odata.type", new JsonPrimitive("#microsoft.graph.dayOfWeek"));
workingHours1.day = DayOfWeek.TUESDAY;
workingHours1.additionalDataManager().put("timeSlots@odata.type", new JsonPrimitive("#Collection(microsoft.graph.bookingWorkTimeSlot)"));
LinkedList<BookingWorkTimeSlot> timeSlotsList1 = new LinkedList<BookingWorkTimeSlot>();
BookingWorkTimeSlot timeSlots = new BookingWorkTimeSlot();
timeSlots.end = new TimeOfDay(0, 0, 0);
timeSlots.start = new TimeOfDay(0, 0, 0);
timeSlotsList1.add(timeSlots);
workingHours1.timeSlots = timeSlotsList1;
workingHoursList.add(workingHours1);
BookingWorkHours workingHours2 = new BookingWorkHours();
workingHours2.additionalDataManager().put("day@odata.type", new JsonPrimitive("#microsoft.graph.dayOfWeek"));
workingHours2.day = DayOfWeek.WEDNESDAY;
workingHours2.additionalDataManager().put("timeSlots@odata.type", new JsonPrimitive("#Collection(microsoft.graph.bookingWorkTimeSlot)"));
LinkedList<BookingWorkTimeSlot> timeSlotsList2 = new LinkedList<BookingWorkTimeSlot>();
BookingWorkTimeSlot timeSlots1 = new BookingWorkTimeSlot();
timeSlots1.end = new TimeOfDay(0, 0, 0);
timeSlots1.start = new TimeOfDay(0, 0, 0);
timeSlotsList2.add(timeSlots1);
workingHours2.timeSlots = timeSlotsList2;
workingHoursList.add(workingHours2);
BookingWorkHours workingHours3 = new BookingWorkHours();
workingHours3.additionalDataManager().put("day@odata.type", new JsonPrimitive("#microsoft.graph.dayOfWeek"));
workingHours3.day = DayOfWeek.THURSDAY;
workingHours3.additionalDataManager().put("timeSlots@odata.type", new JsonPrimitive("#Collection(microsoft.graph.bookingWorkTimeSlot)"));
LinkedList<BookingWorkTimeSlot> timeSlotsList3 = new LinkedList<BookingWorkTimeSlot>();
BookingWorkTimeSlot timeSlots2 = new BookingWorkTimeSlot();
timeSlots2.end = new TimeOfDay(0, 0, 0);
timeSlots2.start = new TimeOfDay(0, 0, 0);
timeSlotsList3.add(timeSlots2);
workingHours3.timeSlots = timeSlotsList3;
workingHoursList.add(workingHours3);
BookingWorkHours workingHours4 = new BookingWorkHours();
workingHours4.additionalDataManager().put("day@odata.type", new JsonPrimitive("#microsoft.graph.dayOfWeek"));
workingHours4.day = DayOfWeek.FRIDAY;
workingHours4.additionalDataManager().put("timeSlots@odata.type", new JsonPrimitive("#Collection(microsoft.graph.bookingWorkTimeSlot)"));
LinkedList<BookingWorkTimeSlot> timeSlotsList4 = new LinkedList<BookingWorkTimeSlot>();
BookingWorkTimeSlot timeSlots3 = new BookingWorkTimeSlot();
timeSlots3.end = new TimeOfDay(0, 0, 0);
timeSlots3.start = new TimeOfDay(0, 0, 0);
timeSlotsList4.add(timeSlots3);
workingHours4.timeSlots = timeSlotsList4;
workingHoursList.add(workingHours4);
bookingStaffMember.workingHours = workingHoursList;
graphClient.bookingBusinesses("Contosolunchdelivery@contoso.onmicrosoft.com").staffMembers("8ee1c803-a1fa-406d-8259-7ab53233f148")
.buildRequest()
.patch(bookingStaffMember);
Import-Module Microsoft.Graph.Bookings
$params = @{
WorkingHours = @(
@{
"@odata.type" = "#microsoft.graph.bookingWorkHours"
"Day@odata.type" = "#microsoft.graph.dayOfWeek"
Day = "monday"
"TimeSlots@odata.type" = "#Collection(microsoft.graph.bookingWorkTimeSlot)"
TimeSlots = @(
)
}
@{
"@odata.type" = "#microsoft.graph.bookingWorkHours"
"Day@odata.type" = "#microsoft.graph.dayOfWeek"
Day = "tuesday"
"TimeSlots@odata.type" = "#Collection(microsoft.graph.bookingWorkTimeSlot)"
TimeSlots = @(
@{
"@odata.type" = "#microsoft.graph.bookingWorkTimeSlot"
End = "17:00:00.0000000"
Start = "08:00:00.0000000"
}
)
}
@{
"@odata.type" = "#microsoft.graph.bookingWorkHours"
"Day@odata.type" = "#microsoft.graph.dayOfWeek"
Day = "wednesday"
"TimeSlots@odata.type" = "#Collection(microsoft.graph.bookingWorkTimeSlot)"
TimeSlots = @(
@{
"@odata.type" = "#microsoft.graph.bookingWorkTimeSlot"
End = "17:00:00.0000000"
Start = "08:00:00.0000000"
}
)
}
@{
"@odata.type" = "#microsoft.graph.bookingWorkHours"
"Day@odata.type" = "#microsoft.graph.dayOfWeek"
Day = "thursday"
"TimeSlots@odata.type" = "#Collection(microsoft.graph.bookingWorkTimeSlot)"
TimeSlots = @(
@{
"@odata.type" = "#microsoft.graph.bookingWorkTimeSlot"
End = "17:00:00.0000000"
Start = "08:00:00.0000000"
}
)
}
@{
"@odata.type" = "#microsoft.graph.bookingWorkHours"
"Day@odata.type" = "#microsoft.graph.dayOfWeek"
Day = "friday"
"TimeSlots@odata.type" = "#Collection(microsoft.graph.bookingWorkTimeSlot)"
TimeSlots = @(
@{
"@odata.type" = "#microsoft.graph.bookingWorkTimeSlot"
End = "17:00:00.0000000"
Start = "08:00:00.0000000"
}
)
}
)
}
Update-MgBookingBusinessStaffMember -BookingBusinessId $bookingBusinessId -BookingStaffMemberId $bookingStaffMemberId -BodyParameter $params
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewBookingStaffMember()
requestBody.SetWorkingHours( []BookingWorkHours {
msgraphsdk.NewBookingWorkHours(),
day := "monday"
SetDay(&day)
SetTimeSlots( []BookingWorkTimeSlot {
}
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingWorkHours",
"day@odata.type": "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type": "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
msgraphsdk.NewBookingWorkHours(),
day := "tuesday"
SetDay(&day)
SetTimeSlots( []BookingWorkTimeSlot {
msgraphsdk.NewBookingWorkTimeSlot(),
end := "17:00:00.0000000"
SetEnd(&end)
start := "08:00:00.0000000"
SetStart(&start)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingWorkTimeSlot",
}
}
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingWorkHours",
"day@odata.type": "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type": "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
msgraphsdk.NewBookingWorkHours(),
day := "wednesday"
SetDay(&day)
SetTimeSlots( []BookingWorkTimeSlot {
msgraphsdk.NewBookingWorkTimeSlot(),
end := "17:00:00.0000000"
SetEnd(&end)
start := "08:00:00.0000000"
SetStart(&start)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingWorkTimeSlot",
}
}
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingWorkHours",
"day@odata.type": "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type": "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
msgraphsdk.NewBookingWorkHours(),
day := "thursday"
SetDay(&day)
SetTimeSlots( []BookingWorkTimeSlot {
msgraphsdk.NewBookingWorkTimeSlot(),
end := "17:00:00.0000000"
SetEnd(&end)
start := "08:00:00.0000000"
SetStart(&start)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingWorkTimeSlot",
}
}
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingWorkHours",
"day@odata.type": "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type": "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
msgraphsdk.NewBookingWorkHours(),
day := "friday"
SetDay(&day)
SetTimeSlots( []BookingWorkTimeSlot {
msgraphsdk.NewBookingWorkTimeSlot(),
end := "17:00:00.0000000"
SetEnd(&end)
start := "08:00:00.0000000"
SetStart(&start)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingWorkTimeSlot",
}
}
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingWorkHours",
"day@odata.type": "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type": "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
}
bookingBusinessId := "bookingBusiness-id"
bookingStaffMemberId := "bookingStaffMember-id"
graphClient.BookingBusinessesById(&bookingBusinessId).StaffMembersById(&bookingStaffMemberId).Patch(requestBody)
Nachfolgend sehen Sie ein Beispiel der Antwort.