POST https://graph.microsoft.com/beta/solutions/bookingbusinesses/{id}/staffMembers
Content-type: application/json
{
"@odata.type":"#microsoft.graph.bookingStaffMember",
"colorIndex":1,
"displayName":"Dana Swope",
"emailAddress":"danas@contoso.com",
"role@odata.type":"#microsoft.graph.bookingStaffRole",
"role":"externalGuest",
"timeZone":"America/Chicago",
"useBusinessHours":true,
"workingHours@odata.type":"#Collection(microsoft.graph.bookingWorkHours)",
"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.bookingWorkTimeSlot",
"end":"17:00:00.0000000",
"start":"08:00:00.0000000"
}
]
},
{
"@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"
}
]
}
],
"isEmailNotificationEnabled": false
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new BookingStaffMember
{
OdataType = "#microsoft.graph.bookingStaffMember",
ColorIndex = 1,
DisplayName = "Dana Swope",
EmailAddress = "danas@contoso.com",
Role = BookingStaffRole.ExternalGuest,
TimeZone = "America/Chicago",
UseBusinessHours = true,
WorkingHours = new List<BookingWorkHours>
{
new BookingWorkHours
{
OdataType = "#microsoft.graph.bookingWorkHours",
Day = DayOfWeekObject.Monday,
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.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)"
},
},
},
},
IsEmailNotificationEnabled = false,
AdditionalData = new Dictionary<string, object>
{
{
"role@odata.type" , "#microsoft.graph.bookingStaffRole"
},
{
"workingHours@odata.type" , "#Collection(microsoft.graph.bookingWorkHours)"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BookingBusinesses["{bookingBusiness-id}"].StaffMembers.PostAsync(requestBody);
mgc-beta solutions booking-businesses staff-members create --booking-business-id {bookingBusiness-id} --body '{\
"@odata.type":"#microsoft.graph.bookingStaffMember",\
"colorIndex":1,\
"displayName":"Dana Swope",\
"emailAddress":"danas@contoso.com",\
"role@odata.type":"#microsoft.graph.bookingStaffRole",\
"role":"externalGuest",\
"timeZone":"America/Chicago",\
"useBusinessHours":true,\
"workingHours@odata.type":"#Collection(microsoft.graph.bookingWorkHours)",\
"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.bookingWorkTimeSlot",\
"end":"17:00:00.0000000",\
"start":"08:00:00.0000000"\
}\
]\
},\
{\
"@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"\
}\
]\
}\
],\
"isEmailNotificationEnabled": false\
}\
'
// 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()
colorIndex := int32(1)
requestBody.SetColorIndex(&colorIndex)
displayName := "Dana Swope"
requestBody.SetDisplayName(&displayName)
emailAddress := "danas@contoso.com"
requestBody.SetEmailAddress(&emailAddress)
role := graphmodels.EXTERNALGUEST_BOOKINGSTAFFROLE
requestBody.SetRole(&role)
timeZone := "America/Chicago"
requestBody.SetTimeZone(&timeZone)
useBusinessHours := true
requestBody.SetUseBusinessHours(&useBusinessHours)
bookingWorkHours := graphmodels.NewBookingWorkHours()
day := graphmodels.MONDAY_DAYOFWEEK
bookingWorkHours.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,
}
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)
isEmailNotificationEnabled := false
requestBody.SetIsEmailNotificationEnabled(&isEmailNotificationEnabled)
additionalData := map[string]interface{}{
"role@odata.type" : "#microsoft.graph.bookingStaffRole",
"workingHours@odata.type" : "#Collection(microsoft.graph.bookingWorkHours)",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
staffMembers, err := graphClient.Solutions().BookingBusinesses().ByBookingBusinessId("bookingBusiness-id").StaffMembers().Post(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();
bookingStaffMember.setOdataType("#microsoft.graph.bookingStaffMember");
bookingStaffMember.setColorIndex(1);
bookingStaffMember.setDisplayName("Dana Swope");
bookingStaffMember.setEmailAddress("danas@contoso.com");
bookingStaffMember.setRole(BookingStaffRole.ExternalGuest);
bookingStaffMember.setTimeZone("America/Chicago");
bookingStaffMember.setUseBusinessHours(true);
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>();
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);
timeSlots.add(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 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);
timeSlots1.add(bookingWorkTimeSlot1);
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 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);
timeSlots2.add(bookingWorkTimeSlot2);
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 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);
timeSlots3.add(bookingWorkTimeSlot3);
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 bookingWorkTimeSlot4 = new BookingWorkTimeSlot();
bookingWorkTimeSlot4.setOdataType("#microsoft.graph.bookingWorkTimeSlot");
LocalTime end4 = LocalTime.parse("17:00:00.0000000");
bookingWorkTimeSlot4.setEnd(end4);
LocalTime start4 = LocalTime.parse("08:00:00.0000000");
bookingWorkTimeSlot4.setStart(start4);
timeSlots4.add(bookingWorkTimeSlot4);
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.setIsEmailNotificationEnabled(false);
HashMap<String, Object> additionalData5 = new HashMap<String, Object>();
additionalData5.put("role@odata.type", "#microsoft.graph.bookingStaffRole");
additionalData5.put("workingHours@odata.type", "#Collection(microsoft.graph.bookingWorkHours)");
bookingStaffMember.setAdditionalData(additionalData5);
BookingStaffMember result = graphClient.solutions().bookingBusinesses().byBookingBusinessId("{bookingBusiness-id}").staffMembers().post(bookingStaffMember);
const options = {
authProvider,
};
const client = Client.init(options);
const bookingStaffMember = {
'@odata.type':'#microsoft.graph.bookingStaffMember',
colorIndex: 1,
displayName: 'Dana Swope',
emailAddress: 'danas@contoso.com',
'role@odata.type':'#microsoft.graph.bookingStaffRole',
role: 'externalGuest',
timeZone: 'America/Chicago',
useBusinessHours: true,
'workingHours@odata.type':'#Collection(microsoft.graph.bookingWorkHours)',
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.bookingWorkTimeSlot',
end: '17:00:00.0000000',
start: '08:00:00.0000000'
}
]
},
{
'@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'
}
]
}
],
isEmailNotificationEnabled: false
};
await client.api('/solutions/bookingbusinesses/{id}/staffMembers')
.version('beta')
.post(bookingStaffMember);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\BookingStaffMember;
use Microsoft\Graph\Beta\Generated\Models\BookingStaffRole;
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();
$requestBody->setOdataType('#microsoft.graph.bookingStaffMember');
$requestBody->setColorIndex(1);
$requestBody->setDisplayName('Dana Swope');
$requestBody->setEmailAddress('danas@contoso.com');
$requestBody->setRole(new BookingStaffRole('externalGuest'));
$requestBody->setTimeZone('America/Chicago');
$requestBody->setUseBusinessHours(true);
$workingHoursBookingWorkHours1 = new BookingWorkHours();
$workingHoursBookingWorkHours1->setOdataType('#microsoft.graph.bookingWorkHours');
$workingHoursBookingWorkHours1->setDay(new DayOfWeek('monday'));
$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;
$workingHoursBookingWorkHours1->setTimeSlots($timeSlotsArray);
$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);
$requestBody->setIsEmailNotificationEnabled(false);
$additionalData = [
'role@odata.type' => '#microsoft.graph.bookingStaffRole',
'workingHours@odata.type' => '#Collection(microsoft.graph.bookingWorkHours)',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->solutions()->bookingBusinesses()->byBookingBusinessId('bookingBusiness-id')->staffMembers()->post($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_staff_role import BookingStaffRole
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://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = BookingStaffMember(
odata_type = "#microsoft.graph.bookingStaffMember",
color_index = 1,
display_name = "Dana Swope",
email_address = "danas@contoso.com",
role = BookingStaffRole.ExternalGuest,
time_zone = "America/Chicago",
use_business_hours = True,
working_hours = [
BookingWorkHours(
odata_type = "#microsoft.graph.bookingWorkHours",
day = DayOfWeek.Monday,
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.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)",
}
),
],
is_email_notification_enabled = False,
additional_data = {
"role@odata_type" : "#microsoft.graph.bookingStaffRole",
"working_hours@odata_type" : "#Collection(microsoft.graph.bookingWorkHours)",
}
)
result = await graph_client.solutions.booking_businesses.by_booking_business_id('bookingBusiness-id').staff_members.post(request_body)