Dans le corps de la demande, fournissez les valeurs pour les champs appropriés qui doivent être mis à jour. Les propriétés existantes qui ne sont pas incluses dans le corps de la demande conservent leurs valeurs précédentes ou sont recalculées en fonction des modifications apportées à d’autres valeurs de propriété. Pour de meilleures performances, n’incluez pas de valeurs existantes qui n’ont pas été modifiées.
L’exemple suivant modifie l’horaire du membre du personnel de manière à ce que les lundis soient désactivés.
PATCH https://graph.microsoft.com/beta/solutions/bookingbusinesses/contosolunchdelivery@contoso.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"
}
]
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new BookingStaffMember
{
WorkingHours = new List<BookingWorkHours>
{
new BookingWorkHours
{
OdataType = "#microsoft.graph.bookingWorkHours",
Day = DayOfWeekObject.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
{
OdataType = "#microsoft.graph.bookingWorkHours",
Day = DayOfWeekObject.Tuesday,
TimeSlots = new List<BookingWorkTimeSlot>
{
new BookingWorkTimeSlot
{
OdataType = "#microsoft.graph.bookingWorkTimeSlot",
End = new Time(DateTime.Parse("17:00:00.0000000")),
Start = new Time(DateTime.Parse("08:00:00.0000000")),
},
},
AdditionalData = new Dictionary<string, object>
{
{
"day@odata.type" , "#microsoft.graph.dayOfWeek"
},
{
"timeSlots@odata.type" , "#Collection(microsoft.graph.bookingWorkTimeSlot)"
},
},
},
new BookingWorkHours
{
OdataType = "#microsoft.graph.bookingWorkHours",
Day = DayOfWeekObject.Wednesday,
TimeSlots = new List<BookingWorkTimeSlot>
{
new BookingWorkTimeSlot
{
OdataType = "#microsoft.graph.bookingWorkTimeSlot",
End = new Time(DateTime.Parse("17:00:00.0000000")),
Start = new Time(DateTime.Parse("08:00:00.0000000")),
},
},
AdditionalData = new Dictionary<string, object>
{
{
"day@odata.type" , "#microsoft.graph.dayOfWeek"
},
{
"timeSlots@odata.type" , "#Collection(microsoft.graph.bookingWorkTimeSlot)"
},
},
},
new BookingWorkHours
{
OdataType = "#microsoft.graph.bookingWorkHours",
Day = DayOfWeekObject.Thursday,
TimeSlots = new List<BookingWorkTimeSlot>
{
new BookingWorkTimeSlot
{
OdataType = "#microsoft.graph.bookingWorkTimeSlot",
End = new Time(DateTime.Parse("17:00:00.0000000")),
Start = new Time(DateTime.Parse("08:00:00.0000000")),
},
},
AdditionalData = new Dictionary<string, object>
{
{
"day@odata.type" , "#microsoft.graph.dayOfWeek"
},
{
"timeSlots@odata.type" , "#Collection(microsoft.graph.bookingWorkTimeSlot)"
},
},
},
new BookingWorkHours
{
OdataType = "#microsoft.graph.bookingWorkHours",
Day = DayOfWeekObject.Friday,
TimeSlots = new List<BookingWorkTimeSlot>
{
new BookingWorkTimeSlot
{
OdataType = "#microsoft.graph.bookingWorkTimeSlot",
End = new Time(DateTime.Parse("17:00:00.0000000")),
Start = new Time(DateTime.Parse("08:00:00.0000000")),
},
},
AdditionalData = new Dictionary<string, object>
{
{
"day@odata.type" , "#microsoft.graph.dayOfWeek"
},
{
"timeSlots@odata.type" , "#Collection(microsoft.graph.bookingWorkTimeSlot)"
},
},
},
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BookingBusinesses["{bookingBusiness-id}"].StaffMembers["{bookingStaffMember-id}"].PatchAsync(requestBody);
mgc-beta solutions booking-businesses staff-members patch --booking-business-id {bookingBusiness-id} --booking-staff-member-id {bookingStaffMember-id} --body '{\
"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"\
}\
]\
}\
]\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewBookingStaffMember()
bookingWorkHours := graphmodels.NewBookingWorkHours()
day := graphmodels.MONDAY_DAYOFWEEK
bookingWorkHours.SetDay(&day)
timeSlots := []graphmodels.BookingWorkTimeSlotable {
}
bookingWorkHours.SetTimeSlots(timeSlots)
additionalData := map[string]interface{}{
"day@odata.type" : "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
bookingWorkHours.SetAdditionalData(additionalData)
bookingWorkHours1 := graphmodels.NewBookingWorkHours()
day := graphmodels.TUESDAY_DAYOFWEEK
bookingWorkHours1.SetDay(&day)
bookingWorkTimeSlot := graphmodels.NewBookingWorkTimeSlot()
end := 17:00:00.0000000
bookingWorkTimeSlot.SetEnd(&end)
start := 08:00:00.0000000
bookingWorkTimeSlot.SetStart(&start)
timeSlots := []graphmodels.BookingWorkTimeSlotable {
bookingWorkTimeSlot,
}
bookingWorkHours1.SetTimeSlots(timeSlots)
additionalData := map[string]interface{}{
"day@odata.type" : "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
bookingWorkHours1.SetAdditionalData(additionalData)
bookingWorkHours2 := graphmodels.NewBookingWorkHours()
day := graphmodels.WEDNESDAY_DAYOFWEEK
bookingWorkHours2.SetDay(&day)
bookingWorkTimeSlot := graphmodels.NewBookingWorkTimeSlot()
end := 17:00:00.0000000
bookingWorkTimeSlot.SetEnd(&end)
start := 08:00:00.0000000
bookingWorkTimeSlot.SetStart(&start)
timeSlots := []graphmodels.BookingWorkTimeSlotable {
bookingWorkTimeSlot,
}
bookingWorkHours2.SetTimeSlots(timeSlots)
additionalData := map[string]interface{}{
"day@odata.type" : "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
bookingWorkHours2.SetAdditionalData(additionalData)
bookingWorkHours3 := graphmodels.NewBookingWorkHours()
day := graphmodels.THURSDAY_DAYOFWEEK
bookingWorkHours3.SetDay(&day)
bookingWorkTimeSlot := graphmodels.NewBookingWorkTimeSlot()
end := 17:00:00.0000000
bookingWorkTimeSlot.SetEnd(&end)
start := 08:00:00.0000000
bookingWorkTimeSlot.SetStart(&start)
timeSlots := []graphmodels.BookingWorkTimeSlotable {
bookingWorkTimeSlot,
}
bookingWorkHours3.SetTimeSlots(timeSlots)
additionalData := map[string]interface{}{
"day@odata.type" : "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
bookingWorkHours3.SetAdditionalData(additionalData)
bookingWorkHours4 := graphmodels.NewBookingWorkHours()
day := graphmodels.FRIDAY_DAYOFWEEK
bookingWorkHours4.SetDay(&day)
bookingWorkTimeSlot := graphmodels.NewBookingWorkTimeSlot()
end := 17:00:00.0000000
bookingWorkTimeSlot.SetEnd(&end)
start := 08:00:00.0000000
bookingWorkTimeSlot.SetStart(&start)
timeSlots := []graphmodels.BookingWorkTimeSlotable {
bookingWorkTimeSlot,
}
bookingWorkHours4.SetTimeSlots(timeSlots)
additionalData := map[string]interface{}{
"day@odata.type" : "#microsoft.graph.dayOfWeek",
"timeSlots@odata.type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
bookingWorkHours4.SetAdditionalData(additionalData)
workingHours := []graphmodels.BookingWorkHoursable {
bookingWorkHours,
bookingWorkHours1,
bookingWorkHours2,
bookingWorkHours3,
bookingWorkHours4,
}
requestBody.SetWorkingHours(workingHours)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
staffMembers, err := graphClient.Solutions().BookingBusinesses().ByBookingBusinessId("bookingBusiness-id").StaffMembers().ByBookingStaffMemberId("bookingStaffMember-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
BookingStaffMember bookingStaffMember = new BookingStaffMember();
LinkedList<BookingWorkHours> workingHours = new LinkedList<BookingWorkHours>();
BookingWorkHours bookingWorkHours = new BookingWorkHours();
bookingWorkHours.setOdataType("#microsoft.graph.bookingWorkHours");
bookingWorkHours.setDay(DayOfWeek.Monday);
LinkedList<BookingWorkTimeSlot> timeSlots = new LinkedList<BookingWorkTimeSlot>();
bookingWorkHours.setTimeSlots(timeSlots);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("day@odata.type", "#microsoft.graph.dayOfWeek");
additionalData.put("timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)");
bookingWorkHours.setAdditionalData(additionalData);
workingHours.add(bookingWorkHours);
BookingWorkHours bookingWorkHours1 = new BookingWorkHours();
bookingWorkHours1.setOdataType("#microsoft.graph.bookingWorkHours");
bookingWorkHours1.setDay(DayOfWeek.Tuesday);
LinkedList<BookingWorkTimeSlot> timeSlots1 = new LinkedList<BookingWorkTimeSlot>();
BookingWorkTimeSlot bookingWorkTimeSlot = new BookingWorkTimeSlot();
bookingWorkTimeSlot.setOdataType("#microsoft.graph.bookingWorkTimeSlot");
LocalTime end = LocalTime.parse("17:00:00.0000000");
bookingWorkTimeSlot.setEnd(end);
LocalTime start = LocalTime.parse("08:00:00.0000000");
bookingWorkTimeSlot.setStart(start);
timeSlots1.add(bookingWorkTimeSlot);
bookingWorkHours1.setTimeSlots(timeSlots1);
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("day@odata.type", "#microsoft.graph.dayOfWeek");
additionalData1.put("timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)");
bookingWorkHours1.setAdditionalData(additionalData1);
workingHours.add(bookingWorkHours1);
BookingWorkHours bookingWorkHours2 = new BookingWorkHours();
bookingWorkHours2.setOdataType("#microsoft.graph.bookingWorkHours");
bookingWorkHours2.setDay(DayOfWeek.Wednesday);
LinkedList<BookingWorkTimeSlot> timeSlots2 = new LinkedList<BookingWorkTimeSlot>();
BookingWorkTimeSlot bookingWorkTimeSlot1 = new BookingWorkTimeSlot();
bookingWorkTimeSlot1.setOdataType("#microsoft.graph.bookingWorkTimeSlot");
LocalTime end1 = LocalTime.parse("17:00:00.0000000");
bookingWorkTimeSlot1.setEnd(end1);
LocalTime start1 = LocalTime.parse("08:00:00.0000000");
bookingWorkTimeSlot1.setStart(start1);
timeSlots2.add(bookingWorkTimeSlot1);
bookingWorkHours2.setTimeSlots(timeSlots2);
HashMap<String, Object> additionalData2 = new HashMap<String, Object>();
additionalData2.put("day@odata.type", "#microsoft.graph.dayOfWeek");
additionalData2.put("timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)");
bookingWorkHours2.setAdditionalData(additionalData2);
workingHours.add(bookingWorkHours2);
BookingWorkHours bookingWorkHours3 = new BookingWorkHours();
bookingWorkHours3.setOdataType("#microsoft.graph.bookingWorkHours");
bookingWorkHours3.setDay(DayOfWeek.Thursday);
LinkedList<BookingWorkTimeSlot> timeSlots3 = new LinkedList<BookingWorkTimeSlot>();
BookingWorkTimeSlot bookingWorkTimeSlot2 = new BookingWorkTimeSlot();
bookingWorkTimeSlot2.setOdataType("#microsoft.graph.bookingWorkTimeSlot");
LocalTime end2 = LocalTime.parse("17:00:00.0000000");
bookingWorkTimeSlot2.setEnd(end2);
LocalTime start2 = LocalTime.parse("08:00:00.0000000");
bookingWorkTimeSlot2.setStart(start2);
timeSlots3.add(bookingWorkTimeSlot2);
bookingWorkHours3.setTimeSlots(timeSlots3);
HashMap<String, Object> additionalData3 = new HashMap<String, Object>();
additionalData3.put("day@odata.type", "#microsoft.graph.dayOfWeek");
additionalData3.put("timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)");
bookingWorkHours3.setAdditionalData(additionalData3);
workingHours.add(bookingWorkHours3);
BookingWorkHours bookingWorkHours4 = new BookingWorkHours();
bookingWorkHours4.setOdataType("#microsoft.graph.bookingWorkHours");
bookingWorkHours4.setDay(DayOfWeek.Friday);
LinkedList<BookingWorkTimeSlot> timeSlots4 = new LinkedList<BookingWorkTimeSlot>();
BookingWorkTimeSlot bookingWorkTimeSlot3 = new BookingWorkTimeSlot();
bookingWorkTimeSlot3.setOdataType("#microsoft.graph.bookingWorkTimeSlot");
LocalTime end3 = LocalTime.parse("17:00:00.0000000");
bookingWorkTimeSlot3.setEnd(end3);
LocalTime start3 = LocalTime.parse("08:00:00.0000000");
bookingWorkTimeSlot3.setStart(start3);
timeSlots4.add(bookingWorkTimeSlot3);
bookingWorkHours4.setTimeSlots(timeSlots4);
HashMap<String, Object> additionalData4 = new HashMap<String, Object>();
additionalData4.put("day@odata.type", "#microsoft.graph.dayOfWeek");
additionalData4.put("timeSlots@odata.type", "#Collection(microsoft.graph.bookingWorkTimeSlot)");
bookingWorkHours4.setAdditionalData(additionalData4);
workingHours.add(bookingWorkHours4);
bookingStaffMember.setWorkingHours(workingHours);
BookingStaffMember result = graphClient.solutions().bookingBusinesses().byBookingBusinessId("{bookingBusiness-id}").staffMembers().byBookingStaffMemberId("{bookingStaffMember-id}").patch(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('/solutions/bookingbusinesses/contosolunchdelivery@contoso.com/staffMembers/8ee1c803-a1fa-406d-8259-7ab53233f148')
.version('beta')
.update(bookingStaffMember);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\BookingStaffMember;
use Microsoft\Graph\Beta\Generated\Models\BookingWorkHours;
use Microsoft\Graph\Beta\Generated\Models\DayOfWeek;
use Microsoft\Graph\Beta\Generated\Models\BookingWorkTimeSlot;
use Microsoft\Kiota\Abstractions\Types\Time;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new BookingStaffMember();
$workingHoursBookingWorkHours1 = new BookingWorkHours();
$workingHoursBookingWorkHours1->setOdataType('#microsoft.graph.bookingWorkHours');
$workingHoursBookingWorkHours1->setDay(new DayOfWeek('monday'));
$workingHoursBookingWorkHours1->setTimeSlots([ ]);
$additionalData = [
'day@odata.type' => '#microsoft.graph.dayOfWeek',
'timeSlots@odata.type' => '#Collection(microsoft.graph.bookingWorkTimeSlot)',
];
$workingHoursBookingWorkHours1->setAdditionalData($additionalData);
$workingHoursArray []= $workingHoursBookingWorkHours1;
$workingHoursBookingWorkHours2 = new BookingWorkHours();
$workingHoursBookingWorkHours2->setOdataType('#microsoft.graph.bookingWorkHours');
$workingHoursBookingWorkHours2->setDay(new DayOfWeek('tuesday'));
$timeSlotsBookingWorkTimeSlot1 = new BookingWorkTimeSlot();
$timeSlotsBookingWorkTimeSlot1->setOdataType('#microsoft.graph.bookingWorkTimeSlot');
$timeSlotsBookingWorkTimeSlot1->setEnd(new Time('17:00:00.0000000'));
$timeSlotsBookingWorkTimeSlot1->setStart(new Time('08:00:00.0000000'));
$timeSlotsArray []= $timeSlotsBookingWorkTimeSlot1;
$workingHoursBookingWorkHours2->setTimeSlots($timeSlotsArray);
$additionalData = [
'day@odata.type' => '#microsoft.graph.dayOfWeek',
'timeSlots@odata.type' => '#Collection(microsoft.graph.bookingWorkTimeSlot)',
];
$workingHoursBookingWorkHours2->setAdditionalData($additionalData);
$workingHoursArray []= $workingHoursBookingWorkHours2;
$workingHoursBookingWorkHours3 = new BookingWorkHours();
$workingHoursBookingWorkHours3->setOdataType('#microsoft.graph.bookingWorkHours');
$workingHoursBookingWorkHours3->setDay(new DayOfWeek('wednesday'));
$timeSlotsBookingWorkTimeSlot1 = new BookingWorkTimeSlot();
$timeSlotsBookingWorkTimeSlot1->setOdataType('#microsoft.graph.bookingWorkTimeSlot');
$timeSlotsBookingWorkTimeSlot1->setEnd(new Time('17:00:00.0000000'));
$timeSlotsBookingWorkTimeSlot1->setStart(new Time('08:00:00.0000000'));
$timeSlotsArray []= $timeSlotsBookingWorkTimeSlot1;
$workingHoursBookingWorkHours3->setTimeSlots($timeSlotsArray);
$additionalData = [
'day@odata.type' => '#microsoft.graph.dayOfWeek',
'timeSlots@odata.type' => '#Collection(microsoft.graph.bookingWorkTimeSlot)',
];
$workingHoursBookingWorkHours3->setAdditionalData($additionalData);
$workingHoursArray []= $workingHoursBookingWorkHours3;
$workingHoursBookingWorkHours4 = new BookingWorkHours();
$workingHoursBookingWorkHours4->setOdataType('#microsoft.graph.bookingWorkHours');
$workingHoursBookingWorkHours4->setDay(new DayOfWeek('thursday'));
$timeSlotsBookingWorkTimeSlot1 = new BookingWorkTimeSlot();
$timeSlotsBookingWorkTimeSlot1->setOdataType('#microsoft.graph.bookingWorkTimeSlot');
$timeSlotsBookingWorkTimeSlot1->setEnd(new Time('17:00:00.0000000'));
$timeSlotsBookingWorkTimeSlot1->setStart(new Time('08:00:00.0000000'));
$timeSlotsArray []= $timeSlotsBookingWorkTimeSlot1;
$workingHoursBookingWorkHours4->setTimeSlots($timeSlotsArray);
$additionalData = [
'day@odata.type' => '#microsoft.graph.dayOfWeek',
'timeSlots@odata.type' => '#Collection(microsoft.graph.bookingWorkTimeSlot)',
];
$workingHoursBookingWorkHours4->setAdditionalData($additionalData);
$workingHoursArray []= $workingHoursBookingWorkHours4;
$workingHoursBookingWorkHours5 = new BookingWorkHours();
$workingHoursBookingWorkHours5->setOdataType('#microsoft.graph.bookingWorkHours');
$workingHoursBookingWorkHours5->setDay(new DayOfWeek('friday'));
$timeSlotsBookingWorkTimeSlot1 = new BookingWorkTimeSlot();
$timeSlotsBookingWorkTimeSlot1->setOdataType('#microsoft.graph.bookingWorkTimeSlot');
$timeSlotsBookingWorkTimeSlot1->setEnd(new Time('17:00:00.0000000'));
$timeSlotsBookingWorkTimeSlot1->setStart(new Time('08:00:00.0000000'));
$timeSlotsArray []= $timeSlotsBookingWorkTimeSlot1;
$workingHoursBookingWorkHours5->setTimeSlots($timeSlotsArray);
$additionalData = [
'day@odata.type' => '#microsoft.graph.dayOfWeek',
'timeSlots@odata.type' => '#Collection(microsoft.graph.bookingWorkTimeSlot)',
];
$workingHoursBookingWorkHours5->setAdditionalData($additionalData);
$workingHoursArray []= $workingHoursBookingWorkHours5;
$requestBody->setWorkingHours($workingHoursArray);
$result = $graphServiceClient->solutions()->bookingBusinesses()->byBookingBusinessId('bookingBusiness-id')->staffMembers()->byBookingStaffMemberId('bookingStaffMember-id')->patch($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.booking_staff_member import BookingStaffMember
from msgraph_beta.generated.models.booking_work_hours import BookingWorkHours
from msgraph_beta.generated.models.day_of_week import DayOfWeek
from msgraph_beta.generated.models.booking_work_time_slot import BookingWorkTimeSlot
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = BookingStaffMember(
working_hours = [
BookingWorkHours(
odata_type = "#microsoft.graph.bookingWorkHours",
day = DayOfWeek.Monday,
time_slots = [
],
additional_data = {
"day@odata_type" : "#microsoft.graph.dayOfWeek",
"time_slots@odata_type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
),
BookingWorkHours(
odata_type = "#microsoft.graph.bookingWorkHours",
day = DayOfWeek.Tuesday,
time_slots = [
BookingWorkTimeSlot(
odata_type = "#microsoft.graph.bookingWorkTimeSlot",
end = "17:00:00.0000000",
start = "08:00:00.0000000",
),
],
additional_data = {
"day@odata_type" : "#microsoft.graph.dayOfWeek",
"time_slots@odata_type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
),
BookingWorkHours(
odata_type = "#microsoft.graph.bookingWorkHours",
day = DayOfWeek.Wednesday,
time_slots = [
BookingWorkTimeSlot(
odata_type = "#microsoft.graph.bookingWorkTimeSlot",
end = "17:00:00.0000000",
start = "08:00:00.0000000",
),
],
additional_data = {
"day@odata_type" : "#microsoft.graph.dayOfWeek",
"time_slots@odata_type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
),
BookingWorkHours(
odata_type = "#microsoft.graph.bookingWorkHours",
day = DayOfWeek.Thursday,
time_slots = [
BookingWorkTimeSlot(
odata_type = "#microsoft.graph.bookingWorkTimeSlot",
end = "17:00:00.0000000",
start = "08:00:00.0000000",
),
],
additional_data = {
"day@odata_type" : "#microsoft.graph.dayOfWeek",
"time_slots@odata_type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
),
BookingWorkHours(
odata_type = "#microsoft.graph.bookingWorkHours",
day = DayOfWeek.Friday,
time_slots = [
BookingWorkTimeSlot(
odata_type = "#microsoft.graph.bookingWorkTimeSlot",
end = "17:00:00.0000000",
start = "08:00:00.0000000",
),
],
additional_data = {
"day@odata_type" : "#microsoft.graph.dayOfWeek",
"time_slots@odata_type" : "#Collection(microsoft.graph.bookingWorkTimeSlot)",
}
),
],
)
result = await graph_client.solutions.booking_businesses.by_booking_business_id('bookingBusiness-id').staff_members.by_booking_staff_member_id('bookingStaffMember-id').patch(request_body)
L’exemple suivant illustre la réponse.