One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
The following is an example of the request.
POST https://graph.microsoft.com/beta/bookingBusinesses/contosolunchdelivery@contoso.onmicrosoft.com/services
Content-type: application/json
{
"@odata.type":"#microsoft.graph.bookingService",
"defaultDuration":"PT1H30M",
"defaultLocation":{
"@odata.type":"#microsoft.graph.location",
"address":{
"@odata.type":"#microsoft.graph.physicalAddress",
"city":"Buffalo",
"countryOrRegion":"USA",
"postalCode":"98052",
"postOfficeBox":null,
"state":"NY",
"street":"4567 First Street",
"type@odata.type":"#microsoft.graph.physicalAddressType",
"type":null
},
"coordinates":null,
"displayName":"Contoso Lunch Delivery",
"locationEmailAddress":null,
"locationType@odata.type":"#microsoft.graph.locationType",
"locationType":null,
"locationUri":null,
"uniqueId":null,
"uniqueIdType@odata.type":"#microsoft.graph.locationUniqueIdType",
"uniqueIdType":null
},
"defaultPrice":10.0,
"defaultPriceType@odata.type":"#microsoft.graph.bookingPriceType",
"defaultPriceType":"fixedPrice",
"defaultReminders@odata.type":"#Collection(microsoft.graph.bookingReminder)",
"defaultReminders":[
{
"@odata.type":"#microsoft.graph.bookingReminder",
"message":"Please be reminded that this service is tomorrow.",
"offset":"P1D",
"recipients@odata.type":"#microsoft.graph.bookingReminderRecipients",
"recipients":"allAttendees"
}
],
"description":"Individual bento box lunch delivery",
"displayName":"Bento",
"isLocationOnline": true,
"smsNotificationsEnabled": true,
"languageTag": "en-US",
"isHiddenFromCustomers":false,
"notes":"Home-cooked special",
"postBuffer":"PT10M",
"preBuffer":"PT5M",
"schedulingPolicy":{
"@odata.type":"#microsoft.graph.bookingSchedulingPolicy",
"allowStaffSelection":true,
"maximumAdvance":"P10D",
"minimumLeadTime":"PT10H",
"sendConfirmationsToOwner":true,
"timeSlotInterval":"PT1H"
},
"staffMemberIds@odata.type":"#Collection(String)",
"staffMemberIds":[
"d90d1e8c-5cfe-48cf-a2d5-966267375b6a",
"2f5f8794-0b29-45b5-b56a-2eb5ff7aa880"
],
"isAnonymousJoinEnabled": false
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var bookingService = new BookingService
{
DefaultDuration = new Duration("PT1H30M"),
DefaultLocation = new Location
{
Address = new PhysicalAddress
{
City = "Buffalo",
CountryOrRegion = "USA",
PostalCode = "98052",
PostOfficeBox = null,
State = "NY",
Street = "4567 First Street",
Type = null,
AdditionalData = new Dictionary<string, object>()
{
{"type@odata.type", "#microsoft.graph.physicalAddressType"}
}
},
Coordinates = null,
DisplayName = "Contoso Lunch Delivery",
LocationEmailAddress = null,
LocationType = null,
LocationUri = null,
UniqueId = null,
UniqueIdType = null,
AdditionalData = new Dictionary<string, object>()
{
{"locationType@odata.type", "#microsoft.graph.locationType"},
{"uniqueIdType@odata.type", "#microsoft.graph.locationUniqueIdType"}
}
},
DefaultPrice = 10,
DefaultPriceType = BookingPriceType.FixedPrice,
DefaultReminders = new List<BookingReminder>()
{
new BookingReminder
{
Message = "Please be reminded that this service is tomorrow.",
Offset = new Duration("P1D"),
Recipients = BookingReminderRecipients.AllAttendees,
AdditionalData = new Dictionary<string, object>()
{
{"recipients@odata.type", "#microsoft.graph.bookingReminderRecipients"}
}
}
},
Description = "Individual bento box lunch delivery",
DisplayName = "Bento",
IsLocationOnline = true,
SmsNotificationsEnabled = true,
LanguageTag = "en-US",
IsHiddenFromCustomers = false,
Notes = "Home-cooked special",
PostBuffer = new Duration("PT10M"),
PreBuffer = new Duration("PT5M"),
SchedulingPolicy = new BookingSchedulingPolicy
{
AllowStaffSelection = true,
MaximumAdvance = new Duration("P10D"),
MinimumLeadTime = new Duration("PT10H"),
SendConfirmationsToOwner = true,
TimeSlotInterval = new Duration("PT1H")
},
StaffMemberIds = new List<String>()
{
"d90d1e8c-5cfe-48cf-a2d5-966267375b6a",
"2f5f8794-0b29-45b5-b56a-2eb5ff7aa880"
},
IsAnonymousJoinEnabled = false,
AdditionalData = new Dictionary<string, object>()
{
{"defaultPriceType@odata.type", "#microsoft.graph.bookingPriceType"},
{"defaultReminders@odata.type", "#Collection(microsoft.graph.bookingReminder)"},
{"staffMemberIds@odata.type", "#Collection(String)"}
}
};
await graphClient.BookingBusinesses["{bookingBusiness-id}"].Services
.Request()
.AddAsync(bookingService);
const options = {
authProvider,
};
const client = Client.init(options);
const bookingService = {
'@odata.type':'#microsoft.graph.bookingService',
defaultDuration: 'PT1H30M',
defaultLocation: {
'@odata.type':'#microsoft.graph.location',
address: {
'@odata.type':'#microsoft.graph.physicalAddress',
city: 'Buffalo',
countryOrRegion: 'USA',
postalCode: '98052',
postOfficeBox: null,
state: 'NY',
street: '4567 First Street',
'type@odata.type':'#microsoft.graph.physicalAddressType',
type: null
},
coordinates: null,
displayName: 'Contoso Lunch Delivery',
locationEmailAddress: null,
'locationType@odata.type':'#microsoft.graph.locationType',
locationType: null,
locationUri: null,
uniqueId: null,
'uniqueIdType@odata.type':'#microsoft.graph.locationUniqueIdType',
uniqueIdType: null
},
defaultPrice: 10.0,
'defaultPriceType@odata.type':'#microsoft.graph.bookingPriceType',
defaultPriceType: 'fixedPrice',
'defaultReminders@odata.type':'#Collection(microsoft.graph.bookingReminder)',
defaultReminders: [
{
'@odata.type':'#microsoft.graph.bookingReminder',
message: 'Please be reminded that this service is tomorrow.',
offset: 'P1D',
'recipients@odata.type':'#microsoft.graph.bookingReminderRecipients',
recipients: 'allAttendees'
}
],
description: 'Individual bento box lunch delivery',
displayName: 'Bento',
isLocationOnline: true,
smsNotificationsEnabled: true,
languageTag: 'en-US',
isHiddenFromCustomers: false,
notes: 'Home-cooked special',
postBuffer: 'PT10M',
preBuffer: 'PT5M',
schedulingPolicy: {
'@odata.type':'#microsoft.graph.bookingSchedulingPolicy',
allowStaffSelection: true,
maximumAdvance: 'P10D',
minimumLeadTime: 'PT10H',
sendConfirmationsToOwner: true,
timeSlotInterval: 'PT1H'
},
'staffMemberIds@odata.type':'#Collection(String)',
staffMemberIds: [
'd90d1e8c-5cfe-48cf-a2d5-966267375b6a',
'2f5f8794-0b29-45b5-b56a-2eb5ff7aa880'
],
isAnonymousJoinEnabled: false
};
await client.api('/bookingBusinesses/contosolunchdelivery@contoso.onmicrosoft.com/services')
.version('beta')
.post(bookingService);
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
BookingService bookingService = new BookingService();
bookingService.defaultDuration = DatatypeFactory.newInstance().newDuration("PT1H30M");
Location defaultLocation = new Location();
PhysicalAddress address = new PhysicalAddress();
address.city = "Buffalo";
address.countryOrRegion = "USA";
address.postalCode = "98052";
address.postOfficeBox = null;
address.state = "NY";
address.street = "4567 First Street";
address.additionalDataManager().put("type@odata.type", new JsonPrimitive("#microsoft.graph.physicalAddressType"));
address.type = null;
defaultLocation.address = address;
defaultLocation.coordinates = null;
defaultLocation.displayName = "Contoso Lunch Delivery";
defaultLocation.locationEmailAddress = null;
defaultLocation.additionalDataManager().put("locationType@odata.type", new JsonPrimitive("#microsoft.graph.locationType"));
defaultLocation.locationType = null;
defaultLocation.locationUri = null;
defaultLocation.uniqueId = null;
defaultLocation.additionalDataManager().put("uniqueIdType@odata.type", new JsonPrimitive("#microsoft.graph.locationUniqueIdType"));
defaultLocation.uniqueIdType = null;
bookingService.defaultLocation = defaultLocation;
bookingService.defaultPrice = 10.0d;
bookingService.additionalDataManager().put("defaultPriceType@odata.type", new JsonPrimitive("#microsoft.graph.bookingPriceType"));
bookingService.defaultPriceType = BookingPriceType.FIXED_PRICE;
bookingService.additionalDataManager().put("defaultReminders@odata.type", new JsonPrimitive("#Collection(microsoft.graph.bookingReminder)"));
LinkedList<BookingReminder> defaultRemindersList = new LinkedList<BookingReminder>();
BookingReminder defaultReminders = new BookingReminder();
defaultReminders.message = "Please be reminded that this service is tomorrow.";
defaultReminders.offset = DatatypeFactory.newInstance().newDuration("P1D");
defaultReminders.additionalDataManager().put("recipients@odata.type", new JsonPrimitive("#microsoft.graph.bookingReminderRecipients"));
defaultReminders.recipients = BookingReminderRecipients.ALL_ATTENDEES;
defaultRemindersList.add(defaultReminders);
bookingService.defaultReminders = defaultRemindersList;
bookingService.description = "Individual bento box lunch delivery";
bookingService.displayName = "Bento";
bookingService.isLocationOnline = true;
bookingService.smsNotificationsEnabled = true;
bookingService.languageTag = "en-US";
bookingService.isHiddenFromCustomers = false;
bookingService.notes = "Home-cooked special";
bookingService.postBuffer = DatatypeFactory.newInstance().newDuration("PT10M");
bookingService.preBuffer = DatatypeFactory.newInstance().newDuration("PT5M");
BookingSchedulingPolicy schedulingPolicy = new BookingSchedulingPolicy();
schedulingPolicy.allowStaffSelection = true;
schedulingPolicy.maximumAdvance = DatatypeFactory.newInstance().newDuration("P10D");
schedulingPolicy.minimumLeadTime = DatatypeFactory.newInstance().newDuration("PT10H");
schedulingPolicy.sendConfirmationsToOwner = true;
schedulingPolicy.timeSlotInterval = DatatypeFactory.newInstance().newDuration("PT1H");
bookingService.schedulingPolicy = schedulingPolicy;
bookingService.additionalDataManager().put("staffMemberIds@odata.type", new JsonPrimitive("#Collection(String)"));
LinkedList<String> staffMemberIdsList = new LinkedList<String>();
staffMemberIdsList.add("d90d1e8c-5cfe-48cf-a2d5-966267375b6a");
staffMemberIdsList.add("2f5f8794-0b29-45b5-b56a-2eb5ff7aa880");
bookingService.staffMemberIds = staffMemberIdsList;
bookingService.isAnonymousJoinEnabled = false;
graphClient.bookingBusinesses("contosolunchdelivery@contoso.onmicrosoft.com").services()
.buildRequest()
.post(bookingService);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := graphmodels.NewBookingService()
"@odata.type" := "#microsoft.graph.bookingService"
requestBody.Set"@odata.type"(&"@odata.type")
defaultDuration := "PT1H30M"
requestBody.SetDefaultDuration(&defaultDuration)
defaultLocation := graphmodels.NewLocation()
"@odata.type" := "#microsoft.graph.location"
defaultLocation.Set"@odata.type"(&"@odata.type")
address := graphmodels.NewPhysicalAddress()
"@odata.type" := "#microsoft.graph.physicalAddress"
address.Set"@odata.type"(&"@odata.type")
city := "Buffalo"
address.SetCity(&city)
countryOrRegion := "USA"
address.SetCountryOrRegion(&countryOrRegion)
postalCode := "98052"
address.SetPostalCode(&postalCode)
postOfficeBox := null
address.SetPostOfficeBox(&postOfficeBox)
state := "NY"
address.SetState(&state)
street := "4567 First Street"
address.SetStreet(&street)
type := null
address.SetType(&type)
additionalData := map[string]interface{}{
"type@odata.type" : "#microsoft.graph.physicalAddressType",
}
address.SetAdditionalData(additionalData)
defaultLocation.SetAddress(address)
coordinates := null
defaultLocation.SetCoordinates(&coordinates)
displayName := "Contoso Lunch Delivery"
defaultLocation.SetDisplayName(&displayName)
locationEmailAddress := null
defaultLocation.SetLocationEmailAddress(&locationEmailAddress)
locationType := null
defaultLocation.SetLocationType(&locationType)
locationUri := null
defaultLocation.SetLocationUri(&locationUri)
uniqueId := null
defaultLocation.SetUniqueId(&uniqueId)
uniqueIdType := null
defaultLocation.SetUniqueIdType(&uniqueIdType)
additionalData := map[string]interface{}{
"locationType@odata.type" : "#microsoft.graph.locationType",
"uniqueIdType@odata.type" : "#microsoft.graph.locationUniqueIdType",
}
defaultLocation.SetAdditionalData(additionalData)
requestBody.SetDefaultLocation(defaultLocation)
defaultPrice := float64(10)
requestBody.SetDefaultPrice(&defaultPrice)
defaultPriceType := graphmodels.FIXEDPRICE_BOOKINGPRICETYPE
requestBody.SetDefaultPriceType(&defaultPriceType)
bookingReminder := graphmodels.NewBookingReminder()
"@odata.type" := "#microsoft.graph.bookingReminder"
bookingReminder.Set"@odata.type"(&"@odata.type")
message := "Please be reminded that this service is tomorrow."
bookingReminder.SetMessage(&message)
offset := "P1D"
bookingReminder.SetOffset(&offset)
recipients := graphmodels.ALLATTENDEES_BOOKINGREMINDERRECIPIENTS
bookingReminder.SetRecipients(&recipients)
additionalData := map[string]interface{}{
"recipients@odata.type" : "#microsoft.graph.bookingReminderRecipients",
}
bookingReminder.SetAdditionalData(additionalData)
defaultReminders := []graphmodels.BookingReminderable {
bookingReminder,
}
requestBody.SetDefaultReminders(defaultReminders)
description := "Individual bento box lunch delivery"
requestBody.SetDescription(&description)
displayName := "Bento"
requestBody.SetDisplayName(&displayName)
isLocationOnline := true
requestBody.SetIsLocationOnline(&isLocationOnline)
smsNotificationsEnabled := true
requestBody.SetSmsNotificationsEnabled(&smsNotificationsEnabled)
languageTag := "en-US"
requestBody.SetLanguageTag(&languageTag)
isHiddenFromCustomers := false
requestBody.SetIsHiddenFromCustomers(&isHiddenFromCustomers)
notes := "Home-cooked special"
requestBody.SetNotes(¬es)
postBuffer := "PT10M"
requestBody.SetPostBuffer(&postBuffer)
preBuffer := "PT5M"
requestBody.SetPreBuffer(&preBuffer)
schedulingPolicy := graphmodels.NewBookingSchedulingPolicy()
"@odata.type" := "#microsoft.graph.bookingSchedulingPolicy"
schedulingPolicy.Set"@odata.type"(&"@odata.type")
allowStaffSelection := true
schedulingPolicy.SetAllowStaffSelection(&allowStaffSelection)
maximumAdvance := "P10D"
schedulingPolicy.SetMaximumAdvance(&maximumAdvance)
minimumLeadTime := "PT10H"
schedulingPolicy.SetMinimumLeadTime(&minimumLeadTime)
sendConfirmationsToOwner := true
schedulingPolicy.SetSendConfirmationsToOwner(&sendConfirmationsToOwner)
timeSlotInterval := "PT1H"
schedulingPolicy.SetTimeSlotInterval(&timeSlotInterval)
requestBody.SetSchedulingPolicy(schedulingPolicy)
staffMemberIds := []string {
"d90d1e8c-5cfe-48cf-a2d5-966267375b6a",
"2f5f8794-0b29-45b5-b56a-2eb5ff7aa880",
}
requestBody.SetStaffMemberIds(staffMemberIds)
isAnonymousJoinEnabled := false
requestBody.SetIsAnonymousJoinEnabled(&isAnonymousJoinEnabled)
additionalData := map[string]interface{}{
"defaultPriceType@odata.type" : "#microsoft.graph.bookingPriceType",
"defaultReminders@odata.type" : "#Collection(microsoft.graph.bookingReminder)",
"staffMemberIds@odata.type" : "#Collection(String)",
}
requestBody.SetAdditionalData(additionalData)
result, err := graphClient.BookingBusinessesById("bookingBusiness-id").Services().Post(requestBody)
Import-Module Microsoft.Graph.Bookings
$params = @{
"@odata.type" = "#microsoft.graph.bookingService"
DefaultDuration = "PT1H30M"
DefaultLocation = @{
"@odata.type" = "#microsoft.graph.location"
Address = @{
"@odata.type" = "#microsoft.graph.physicalAddress"
City = "Buffalo"
CountryOrRegion = "USA"
PostalCode = "98052"
PostOfficeBox = $null
State = "NY"
Street = "4567 First Street"
"Type@odata.type" = "#microsoft.graph.physicalAddressType"
Type = $null
}
Coordinates = $null
DisplayName = "Contoso Lunch Delivery"
LocationEmailAddress = $null
"LocationType@odata.type" = "#microsoft.graph.locationType"
LocationType = $null
LocationUri = $null
UniqueId = $null
"UniqueIdType@odata.type" = "#microsoft.graph.locationUniqueIdType"
UniqueIdType = $null
}
DefaultPrice = 10
"DefaultPriceType@odata.type" = "#microsoft.graph.bookingPriceType"
DefaultPriceType = "fixedPrice"
"DefaultReminders@odata.type" = "#Collection(microsoft.graph.bookingReminder)"
DefaultReminders = @(
@{
"@odata.type" = "#microsoft.graph.bookingReminder"
Message = "Please be reminded that this service is tomorrow."
Offset = "P1D"
"Recipients@odata.type" = "#microsoft.graph.bookingReminderRecipients"
Recipients = "allAttendees"
}
)
Description = "Individual bento box lunch delivery"
DisplayName = "Bento"
IsLocationOnline = $true
SmsNotificationsEnabled = $true
LanguageTag = "en-US"
IsHiddenFromCustomers = $false
Notes = "Home-cooked special"
PostBuffer = "PT10M"
PreBuffer = "PT5M"
SchedulingPolicy = @{
"@odata.type" = "#microsoft.graph.bookingSchedulingPolicy"
AllowStaffSelection = $true
MaximumAdvance = "P10D"
MinimumLeadTime = "PT10H"
SendConfirmationsToOwner = $true
TimeSlotInterval = "PT1H"
}
"StaffMemberIds@odata.type" = "#Collection(String)"
StaffMemberIds = @(
"d90d1e8c-5cfe-48cf-a2d5-966267375b6a"
"2f5f8794-0b29-45b5-b56a-2eb5ff7aa880"
)
IsAnonymousJoinEnabled = $false
}
New-MgBookingBusinessService -BookingBusinessId $bookingBusinessId -BodyParameter $params
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new BookingService();
$requestBody->set@odatatype('#microsoft.graph.bookingService');
$requestBody->setDefaultDuration('PT1H30M');
$defaultLocation = new Location();
$defaultLocation->set@odatatype('#microsoft.graph.location');
$defaultLocationAddress = new PhysicalAddress();
$defaultLocationAddress->set@odatatype('#microsoft.graph.physicalAddress');
$defaultLocationAddress->setCity('Buffalo');
$defaultLocationAddress->setCountryOrRegion('USA');
$defaultLocationAddress->setPostalCode('98052');
$DefaultLocationAddress->setPostOfficeBox(null);
$defaultLocationAddress->setState('NY');
$defaultLocationAddress->setStreet('4567 First Street');
$DefaultLocationAddress->setType(null);
$additionalData = [
'type@odata.type' => '#microsoft.graph.physicalAddressType',
];
$defaultLocationAddress->setAdditionalData($additionalData);
$defaultLocation->setAddress($defaultLocationAddress);
$DefaultLocation->setCoordinates(null);
$defaultLocation->setDisplayName('Contoso Lunch Delivery');
$DefaultLocation->setLocationEmailAddress(null);
$DefaultLocation->setLocationType(null);
$DefaultLocation->setLocationUri(null);
$DefaultLocation->setUniqueId(null);
$DefaultLocation->setUniqueIdType(null);
$additionalData = [
'locationType@odata.type' => '#microsoft.graph.locationType',
'uniqueIdType@odata.type' => '#microsoft.graph.locationUniqueIdType',
];
$defaultLocation->setAdditionalData($additionalData);
$requestBody->setDefaultLocation($defaultLocation);
$requestBody->setDefaultPrice(10);
$requestBody->setDefaultPriceType(new BookingPriceType('fixedprice'));
$defaultRemindersBookingReminder1 = new BookingReminder();
$defaultRemindersBookingReminder1->set@odatatype('#microsoft.graph.bookingReminder');
$defaultRemindersBookingReminder1->setMessage('Please be reminded that this service is tomorrow.');
$defaultRemindersBookingReminder1->setOffset('P1D');
$defaultRemindersBookingReminder1->setRecipients(new BookingReminderRecipients('allattendees'));
$additionalData = [
'recipients@odata.type' => '#microsoft.graph.bookingReminderRecipients',
];
$defaultRemindersBookingReminder1->setAdditionalData($additionalData);
$defaultRemindersArray []= $defaultRemindersBookingReminder1;
$requestBody->setDefaultReminders($defaultRemindersArray);
$requestBody->setDescription('Individual bento box lunch delivery');
$requestBody->setDisplayName('Bento');
$requestBody->setIsLocationOnline(true);
$requestBody->setSmsNotificationsEnabled(true);
$requestBody->setLanguageTag('en-US');
$requestBody->setIsHiddenFromCustomers(false);
$requestBody->setNotes('Home-cooked special');
$requestBody->setPostBuffer('PT10M');
$requestBody->setPreBuffer('PT5M');
$schedulingPolicy = new BookingSchedulingPolicy();
$schedulingPolicy->set@odatatype('#microsoft.graph.bookingSchedulingPolicy');
$schedulingPolicy->setAllowStaffSelection(true);
$schedulingPolicy->setMaximumAdvance('P10D');
$schedulingPolicy->setMinimumLeadTime('PT10H');
$schedulingPolicy->setSendConfirmationsToOwner(true);
$schedulingPolicy->setTimeSlotInterval('PT1H');
$requestBody->setSchedulingPolicy($schedulingPolicy);
$requestBody->setStaffMemberIds(['d90d1e8c-5cfe-48cf-a2d5-966267375b6a', '2f5f8794-0b29-45b5-b56a-2eb5ff7aa880', ]);
$requestBody->setIsAnonymousJoinEnabled(false);
$additionalData = [
'defaultPriceType@odata.type' => '#microsoft.graph.bookingPriceType',
'defaultReminders@odata.type' => '#Collection(microsoft.graph.bookingReminder)',
'staffMemberIds@odata.type' => '#Collection(String)',
];
$requestBody->setAdditionalData($additionalData);
$requestResult = $graphServiceClient->bookingBusinessesById('bookingBusiness-id')->services()->post($requestBody);
The following is an example of the response.