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);
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/services"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphBookingService *bookingService = [[MSGraphBookingService alloc] init];
[bookingService setDefaultDuration:@"PT1H30M"];
MSGraphLocation *defaultLocation = [[MSGraphLocation alloc] init];
MSGraphPhysicalAddress *address = [[MSGraphPhysicalAddress alloc] init];
[address setCity:@"Buffalo"];
[address setCountryOrRegion:@"USA"];
[address setPostalCode:@"98052"];
[address setPostOfficeBox: null];
[address setState:@"NY"];
[address setStreet:@"4567 First Street"];
[address setType: null];
[defaultLocation setAddress:address];
[defaultLocation setCoordinates: null];
[defaultLocation setDisplayName:@"Contoso Lunch Delivery"];
[defaultLocation setLocationEmailAddress: null];
[defaultLocation setLocationType: null];
[defaultLocation setLocationUri: null];
[defaultLocation setUniqueId: null];
[defaultLocation setUniqueIdType: null];
[bookingService setDefaultLocation:defaultLocation];
[bookingService setDefaultPrice: 10.0];
[bookingService setDefaultPriceType: [MSGraphBookingPriceType fixedPrice]];
NSMutableArray *defaultRemindersList = [[NSMutableArray alloc] init];
MSGraphBookingReminder *defaultReminders = [[MSGraphBookingReminder alloc] init];
[defaultReminders setMessage:@"Please be reminded that this service is tomorrow."];
[defaultReminders setOffset:@"P1D"];
[defaultReminders setRecipients: [MSGraphBookingReminderRecipients allAttendees]];
[defaultRemindersList addObject: defaultReminders];
[bookingService setDefaultReminders:defaultRemindersList];
[bookingService setDescription:@"Individual bento box lunch delivery"];
[bookingService setDisplayName:@"Bento"];
[bookingService setIsLocationOnline: true];
[bookingService setSmsNotificationsEnabled: true];
[bookingService setIsHiddenFromCustomers: false];
[bookingService setNotes:@"Home-cooked special"];
[bookingService setPostBuffer:@"PT10M"];
[bookingService setPreBuffer:@"PT5M"];
MSGraphBookingSchedulingPolicy *schedulingPolicy = [[MSGraphBookingSchedulingPolicy alloc] init];
[schedulingPolicy setAllowStaffSelection: true];
[schedulingPolicy setMaximumAdvance:@"P10D"];
[schedulingPolicy setMinimumLeadTime:@"PT10H"];
[schedulingPolicy setSendConfirmationsToOwner: true];
[schedulingPolicy setTimeSlotInterval:@"PT1H"];
[bookingService setSchedulingPolicy:schedulingPolicy];
NSMutableArray *staffMemberIdsList = [[NSMutableArray alloc] init];
[staffMemberIdsList addObject: @"d90d1e8c-5cfe-48cf-a2d5-966267375b6a"];
[staffMemberIdsList addObject: @"2f5f8794-0b29-45b5-b56a-2eb5ff7aa880"];
[bookingService setStaffMemberIds:staffMemberIdsList];
NSError *error;
NSData *bookingServiceData = [bookingService getSerializedDataWithError:&error];
[urlRequest setHTTPBody:bookingServiceData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
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 := msgraphsdk.NewBookingService()
defaultDuration := "PT1H30M"
requestBody.SetDefaultDuration(&defaultDuration)
defaultLocation := msgraphsdk.NewLocation()
requestBody.SetDefaultLocation(defaultLocation)
address := msgraphsdk.NewPhysicalAddress()
defaultLocation.SetAddress(address)
city := "Buffalo"
address.SetCity(&city)
countryOrRegion := "USA"
address.SetCountryOrRegion(&countryOrRegion)
postalCode := "98052"
address.SetPostalCode(&postalCode)
address.SetPostOfficeBox(nil)
state := "NY"
address.SetState(&state)
street := "4567 First Street"
address.SetStreet(&street)
address.SetType(nil)
address.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.physicalAddress",
"type@odata.type": "#microsoft.graph.physicalAddressType",
}
defaultLocation.SetCoordinates(nil)
displayName := "Contoso Lunch Delivery"
defaultLocation.SetDisplayName(&displayName)
defaultLocation.SetLocationEmailAddress(nil)
defaultLocation.SetLocationType(nil)
defaultLocation.SetLocationUri(nil)
defaultLocation.SetUniqueId(nil)
defaultLocation.SetUniqueIdType(nil)
defaultLocation.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.location",
"locationType@odata.type": "#microsoft.graph.locationType",
"uniqueIdType@odata.type": "#microsoft.graph.locationUniqueIdType",
}
defaultPrice := float64(10)
requestBody.SetDefaultPrice(&defaultPrice)
defaultPriceType := "fixedPrice"
requestBody.SetDefaultPriceType(&defaultPriceType)
requestBody.SetDefaultReminders( []BookingReminder {
msgraphsdk.NewBookingReminder(),
message := "Please be reminded that this service is tomorrow."
SetMessage(&message)
offset := "P1D"
SetOffset(&offset)
recipients := "allAttendees"
SetRecipients(&recipients)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingReminder",
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",
}
}
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 := msgraphsdk.NewBookingSchedulingPolicy()
requestBody.SetSchedulingPolicy(schedulingPolicy)
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)
schedulingPolicy.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingSchedulingPolicy",
}
requestBody.SetStaffMemberIds( []String {
"d90d1e8c-5cfe-48cf-a2d5-966267375b6a",
"2f5f8794-0b29-45b5-b56a-2eb5ff7aa880",
}
isAnonymousJoinEnabled := false
requestBody.SetIsAnonymousJoinEnabled(&isAnonymousJoinEnabled)
requestBody.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingService",
"defaultPriceType@odata.type": "#microsoft.graph.bookingPriceType",
"defaultReminders@odata.type": "#Collection(microsoft.graph.bookingReminder)",
"staffMemberIds@odata.type": "#Collection(String)",
}
bookingBusinessId := "bookingBusiness-id"
result, err := graphClient.BookingBusinessesById(&bookingBusinessId).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