Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
The following example shows a request. This appointment doesn't involve booking specific staff members.
POST https://graph.microsoft.com/beta/solutions/bookingbusinesses/contosolunchdelivery@contoso.com/appointments
Content-type: application/json
{
"@odata.type":"#microsoft.graph.bookingAppointment",
"customerEmailAddress":"jordanm@contoso.com",
"customerLocation":{
"@odata.type":"#microsoft.graph.location",
"address":{
"@odata.type":"#microsoft.graph.physicalAddress",
"city":"Buffalo",
"countryOrRegion":"USA",
"postalCode":"98052",
"postOfficeBox":null,
"state":"NY",
"street":"123 First Avenue",
"type@odata.type":"#microsoft.graph.physicalAddressType",
"type":null
},
"coordinates":null,
"displayName":"Customer",
"locationEmailAddress":null,
"locationType@odata.type":"#microsoft.graph.locationType",
"locationType":null,
"locationUri":null,
"uniqueId":null,
"uniqueIdType@odata.type":"#microsoft.graph.locationUniqueIdType",
"uniqueIdType":null
},
"customerName":"Jordan Miller",
"customerNotes":"Please be on time.",
"customerPhone":"213-555-0199",
"customerTimeZone":"America/Chicago",
"smsNotificationsEnabled":true,
"end":{
"@odata.type":"#microsoft.graph.dateTimeTimeZone",
"dateTime":"2018-05-01T12:30:00.0000000+00:00",
"timeZone":"UTC"
},
"invoiceAmount":10.0,
"invoiceDate":{
"@odata.type":"#microsoft.graph.dateTimeTimeZone",
"dateTime":"2018-05-01T12:30:00.0000000+00:00",
"timeZone":"UTC"
},
"invoiceId":"1001",
"invoiceStatus@odata.type":"#microsoft.graph.bookingInvoiceStatus",
"invoiceStatus":"open",
"isCustomerAllowedToManageBooking": true,
"invoiceUrl":"theInvoiceUrl",
"isLocationOnline": true,
"optOutOfCustomerEmail": false,
"anonymousJoinWebUrl": null,
"postBuffer": "PT10M",
"preBuffer": "PT5M",
"price": 10.0,
"priceType@odata.type": "#microsoft.graph.bookingPriceType",
"priceType": "fixedPrice",
"reminders@odata.type": "#Collection(microsoft.graph.bookingReminder)",
"reminders": [
{
"@odata.type": "#microsoft.graph.bookingReminder",
"message": "This service is tomorrow",
"offset": "P1D",
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",
"recipients": "allAttendees"
},
{
"@odata.type": "#microsoft.graph.bookingReminder",
"message": "Please be available to enjoy your lunch service.",
"offset": "PT1H",
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",
"recipients": "customer"
},
{
"@odata.type": "#microsoft.graph.bookingReminder",
"message": "Please check traffic for next cater.",
"offset": "PT2H",
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",
"recipients": "staff"
}
],
"serviceId": "57da6774-a087-4d69-b0e6-6fb82c339976",
"serviceLocation": {
"@odata.type": "#microsoft.graph.location",
"address": {
"@odata.type": "#microsoft.graph.physicalAddress",
"city": "Buffalo",
"countryOrRegion": "USA",
"postalCode": "98052",
"postOfficeBox": null,
"state": "NY",
"street": "123 First Avenue",
"type@odata.type": "#microsoft.graph.physicalAddressType",
"type": null
},
"coordinates": null,
"displayName": "Customer location",
"locationEmailAddress": null,
"locationType@odata.type": "#microsoft.graph.locationType",
"locationType": null,
"locationUri": null,
"uniqueId": null,
"uniqueIdType@odata.type": "#microsoft.graph.locationUniqueIdType",
"uniqueIdType": null
},
"serviceName": "Catered bento",
"serviceNotes": "Customer requires punctual service.",
"start": {
"@odata.type": "#microsoft.graph.dateTimeTimeZone",
"dateTime": "2018-05-01T12:00:00.0000000+00:00",
"timeZone": "UTC"
},
"maximumAttendeesCount": 5,
"filledAttendeesCount": 1,
"customers": [
{
"@odata.type": "#microsoft.graph.bookingCustomerInformation",
"customerId": "7ed53fa5-9ef2-4f2f-975b-27447440bc09",
"name": "Jordan Miller",
"emailAddress": "jordanm@contoso.com",
"phone": "213-555-0199",
"notes": null,
"location": {
"@odata.type": "#microsoft.graph.location",
"displayName": "Customer",
"locationEmailAddress": null,
"locationUri": "",
"locationType": null,
"uniqueId": null,
"uniqueIdType": null,
"address": {
"@odata.type": "#microsoft.graph.physicalAddress",
"type": "home",
"postOfficeBox": "",
"street": "",
"city": "",
"state": "",
"countryOrRegion": "",
"postalCode": ""
},
"coordinates": {
"altitude": null,
"latitude": null,
"longitude": null,
"accuracy": null,
"altitudeAccuracy": null
}
},
"timeZone":"America/Chicago",
"customQuestionAnswers": [
{
"questionId": "3bc6fde0-4ad3-445d-ab17-0fc15dba0774",
"question": "What is your age",
"answerInputType": "text",
"answerOptions": [],
"isRequired": true,
"answer": "25",
"selectedOptions": []
}
]
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new BookingAppointment
{
OdataType = "#microsoft.graph.bookingAppointment",
CustomerEmailAddress = "jordanm@contoso.com",
CustomerLocation = new Location
{
OdataType = "#microsoft.graph.location",
Address = new PhysicalAddress
{
OdataType = "#microsoft.graph.physicalAddress",
City = "Buffalo",
CountryOrRegion = "USA",
PostalCode = "98052",
PostOfficeBox = null,
State = "NY",
Street = "123 First Avenue",
Type = null,
AdditionalData = new Dictionary<string, object>
{
{
"type@odata.type" , "#microsoft.graph.physicalAddressType"
},
},
},
Coordinates = null,
DisplayName = "Customer",
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"
},
},
},
CustomerName = "Jordan Miller",
CustomerNotes = "Please be on time.",
CustomerPhone = "213-555-0199",
CustomerTimeZone = "America/Chicago",
SmsNotificationsEnabled = true,
End = new DateTimeTimeZone
{
OdataType = "#microsoft.graph.dateTimeTimeZone",
DateTime = "2018-05-01T12:30:00.0000000+00:00",
TimeZone = "UTC",
},
InvoiceAmount = 10d,
InvoiceDate = new DateTimeTimeZone
{
OdataType = "#microsoft.graph.dateTimeTimeZone",
DateTime = "2018-05-01T12:30:00.0000000+00:00",
TimeZone = "UTC",
},
InvoiceId = "1001",
InvoiceStatus = BookingInvoiceStatus.Open,
IsCustomerAllowedToManageBooking = true,
InvoiceUrl = "theInvoiceUrl",
IsLocationOnline = true,
OptOutOfCustomerEmail = false,
AnonymousJoinWebUrl = null,
PostBuffer = TimeSpan.Parse("PT10M"),
PreBuffer = TimeSpan.Parse("PT5M"),
Price = 10d,
PriceType = BookingPriceType.FixedPrice,
Reminders = new List<BookingReminder>
{
new BookingReminder
{
OdataType = "#microsoft.graph.bookingReminder",
Message = "This service is tomorrow",
Offset = TimeSpan.Parse("P1D"),
Recipients = BookingReminderRecipients.AllAttendees,
AdditionalData = new Dictionary<string, object>
{
{
"recipients@odata.type" , "#microsoft.graph.bookingReminderRecipients"
},
},
},
new BookingReminder
{
OdataType = "#microsoft.graph.bookingReminder",
Message = "Please be available to enjoy your lunch service.",
Offset = TimeSpan.Parse("PT1H"),
Recipients = BookingReminderRecipients.Customer,
AdditionalData = new Dictionary<string, object>
{
{
"recipients@odata.type" , "#microsoft.graph.bookingReminderRecipients"
},
},
},
new BookingReminder
{
OdataType = "#microsoft.graph.bookingReminder",
Message = "Please check traffic for next cater.",
Offset = TimeSpan.Parse("PT2H"),
Recipients = BookingReminderRecipients.Staff,
AdditionalData = new Dictionary<string, object>
{
{
"recipients@odata.type" , "#microsoft.graph.bookingReminderRecipients"
},
},
},
},
ServiceId = "57da6774-a087-4d69-b0e6-6fb82c339976",
ServiceLocation = new Location
{
OdataType = "#microsoft.graph.location",
Address = new PhysicalAddress
{
OdataType = "#microsoft.graph.physicalAddress",
City = "Buffalo",
CountryOrRegion = "USA",
PostalCode = "98052",
PostOfficeBox = null,
State = "NY",
Street = "123 First Avenue",
Type = null,
AdditionalData = new Dictionary<string, object>
{
{
"type@odata.type" , "#microsoft.graph.physicalAddressType"
},
},
},
Coordinates = null,
DisplayName = "Customer location",
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"
},
},
},
ServiceName = "Catered bento",
ServiceNotes = "Customer requires punctual service.",
Start = new DateTimeTimeZone
{
OdataType = "#microsoft.graph.dateTimeTimeZone",
DateTime = "2018-05-01T12:00:00.0000000+00:00",
TimeZone = "UTC",
},
MaximumAttendeesCount = 5,
FilledAttendeesCount = 1,
Customers = new List<BookingCustomerInformationBase>
{
new BookingCustomerInformation
{
OdataType = "#microsoft.graph.bookingCustomerInformation",
CustomerId = "7ed53fa5-9ef2-4f2f-975b-27447440bc09",
Name = "Jordan Miller",
EmailAddress = "jordanm@contoso.com",
Phone = "213-555-0199",
Notes = null,
Location = new Location
{
OdataType = "#microsoft.graph.location",
DisplayName = "Customer",
LocationEmailAddress = null,
LocationUri = "",
LocationType = null,
UniqueId = null,
UniqueIdType = null,
Address = new PhysicalAddress
{
OdataType = "#microsoft.graph.physicalAddress",
Type = PhysicalAddressType.Home,
PostOfficeBox = "",
Street = "",
City = "",
State = "",
CountryOrRegion = "",
PostalCode = "",
},
Coordinates = new OutlookGeoCoordinates
{
Altitude = null,
Latitude = null,
Longitude = null,
Accuracy = null,
AltitudeAccuracy = null,
},
},
TimeZone = "America/Chicago",
CustomQuestionAnswers = new List<BookingQuestionAnswer>
{
new BookingQuestionAnswer
{
QuestionId = "3bc6fde0-4ad3-445d-ab17-0fc15dba0774",
Question = "What is your age",
AnswerInputType = AnswerInputType.Text,
AnswerOptions = new List<string>
{
},
IsRequired = true,
Answer = "25",
SelectedOptions = new List<string>
{
},
},
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"invoiceStatus@odata.type" , "#microsoft.graph.bookingInvoiceStatus"
},
{
"priceType@odata.type" , "#microsoft.graph.bookingPriceType"
},
{
"reminders@odata.type" , "#Collection(microsoft.graph.bookingReminder)"
},
},
};
// 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}"].Appointments.PostAsync(requestBody);
mgc-beta solutions booking-businesses appointments create --booking-business-id {bookingBusiness-id} --body '{\
"@odata.type":"#microsoft.graph.bookingAppointment",\
"customerEmailAddress":"jordanm@contoso.com",\
"customerLocation":{\
"@odata.type":"#microsoft.graph.location",\
"address":{\
"@odata.type":"#microsoft.graph.physicalAddress",\
"city":"Buffalo",\
"countryOrRegion":"USA",\
"postalCode":"98052",\
"postOfficeBox":null,\
"state":"NY",\
"street":"123 First Avenue",\
"type@odata.type":"#microsoft.graph.physicalAddressType",\
"type":null\
},\
"coordinates":null,\
"displayName":"Customer",\
"locationEmailAddress":null,\
"locationType@odata.type":"#microsoft.graph.locationType",\
"locationType":null,\
"locationUri":null,\
"uniqueId":null,\
"uniqueIdType@odata.type":"#microsoft.graph.locationUniqueIdType",\
"uniqueIdType":null\
},\
"customerName":"Jordan Miller",\
"customerNotes":"Please be on time.",\
"customerPhone":"213-555-0199",\
"customerTimeZone":"America/Chicago",\
"smsNotificationsEnabled":true,\
"end":{\
"@odata.type":"#microsoft.graph.dateTimeTimeZone",\
"dateTime":"2018-05-01T12:30:00.0000000+00:00",\
"timeZone":"UTC"\
},\
"invoiceAmount":10.0,\
"invoiceDate":{\
"@odata.type":"#microsoft.graph.dateTimeTimeZone",\
"dateTime":"2018-05-01T12:30:00.0000000+00:00",\
"timeZone":"UTC"\
},\
"invoiceId":"1001",\
"invoiceStatus@odata.type":"#microsoft.graph.bookingInvoiceStatus",\
"invoiceStatus":"open",\
"isCustomerAllowedToManageBooking": true,\
"invoiceUrl":"theInvoiceUrl",\
"isLocationOnline": true,\
"optOutOfCustomerEmail": false,\
"anonymousJoinWebUrl": null,\
"postBuffer": "PT10M",\
"preBuffer": "PT5M",\
"price": 10.0,\
"priceType@odata.type": "#microsoft.graph.bookingPriceType",\
"priceType": "fixedPrice",\
"reminders@odata.type": "#Collection(microsoft.graph.bookingReminder)",\
"reminders": [\
{\
"@odata.type": "#microsoft.graph.bookingReminder",\
"message": "This service is tomorrow",\
"offset": "P1D",\
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",\
"recipients": "allAttendees"\
},\
{\
"@odata.type": "#microsoft.graph.bookingReminder",\
"message": "Please be available to enjoy your lunch service.",\
"offset": "PT1H",\
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",\
"recipients": "customer"\
},\
{\
"@odata.type": "#microsoft.graph.bookingReminder",\
"message": "Please check traffic for next cater.",\
"offset": "PT2H",\
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",\
"recipients": "staff"\
}\
],\
"serviceId": "57da6774-a087-4d69-b0e6-6fb82c339976",\
"serviceLocation": {\
"@odata.type": "#microsoft.graph.location",\
"address": {\
"@odata.type": "#microsoft.graph.physicalAddress",\
"city": "Buffalo",\
"countryOrRegion": "USA",\
"postalCode": "98052",\
"postOfficeBox": null,\
"state": "NY",\
"street": "123 First Avenue",\
"type@odata.type": "#microsoft.graph.physicalAddressType",\
"type": null\
},\
"coordinates": null,\
"displayName": "Customer location",\
"locationEmailAddress": null,\
"locationType@odata.type": "#microsoft.graph.locationType",\
"locationType": null,\
"locationUri": null,\
"uniqueId": null,\
"uniqueIdType@odata.type": "#microsoft.graph.locationUniqueIdType",\
"uniqueIdType": null\
},\
"serviceName": "Catered bento",\
"serviceNotes": "Customer requires punctual service.",\
"start": {\
"@odata.type": "#microsoft.graph.dateTimeTimeZone",\
"dateTime": "2018-05-01T12:00:00.0000000+00:00",\
"timeZone": "UTC"\
},\
"maximumAttendeesCount": 5,\
"filledAttendeesCount": 1,\
"customers": [\
{\
"@odata.type": "#microsoft.graph.bookingCustomerInformation",\
"customerId": "7ed53fa5-9ef2-4f2f-975b-27447440bc09",\
"name": "Jordan Miller",\
"emailAddress": "jordanm@contoso.com",\
"phone": "213-555-0199",\
"notes": null,\
"location": {\
"@odata.type": "#microsoft.graph.location",\
"displayName": "Customer",\
"locationEmailAddress": null,\
"locationUri": "",\
"locationType": null,\
"uniqueId": null,\
"uniqueIdType": null,\
"address": {\
"@odata.type": "#microsoft.graph.physicalAddress",\
"type": "home",\
"postOfficeBox": "",\
"street": "",\
"city": "",\
"state": "",\
"countryOrRegion": "",\
"postalCode": ""\
},\
"coordinates": {\
"altitude": null,\
"latitude": null,\
"longitude": null,\
"accuracy": null,\
"altitudeAccuracy": null\
}\
},\
"timeZone":"America/Chicago",\
"customQuestionAnswers": [\
{\
"questionId": "3bc6fde0-4ad3-445d-ab17-0fc15dba0774",\
"question": "What is your age",\
"answerInputType": "text",\
"answerOptions": [],\
"isRequired": true,\
"answer": "25",\
"selectedOptions": []\
}\
]\
}\
]\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewBookingAppointment()
customerEmailAddress := "jordanm@contoso.com"
requestBody.SetCustomerEmailAddress(&customerEmailAddress)
customerLocation := graphmodels.NewLocation()
address := graphmodels.NewPhysicalAddress()
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 := "123 First Avenue"
address.SetStreet(&street)
type := null
address.SetType(&type)
additionalData := map[string]interface{}{
"type@odata.type" : "#microsoft.graph.physicalAddressType",
}
address.SetAdditionalData(additionalData)
customerLocation.SetAddress(address)
coordinates := null
customerLocation.SetCoordinates(&coordinates)
displayName := "Customer"
customerLocation.SetDisplayName(&displayName)
locationEmailAddress := null
customerLocation.SetLocationEmailAddress(&locationEmailAddress)
locationType := null
customerLocation.SetLocationType(&locationType)
locationUri := null
customerLocation.SetLocationUri(&locationUri)
uniqueId := null
customerLocation.SetUniqueId(&uniqueId)
uniqueIdType := null
customerLocation.SetUniqueIdType(&uniqueIdType)
additionalData := map[string]interface{}{
"locationType@odata.type" : "#microsoft.graph.locationType",
"uniqueIdType@odata.type" : "#microsoft.graph.locationUniqueIdType",
}
customerLocation.SetAdditionalData(additionalData)
requestBody.SetCustomerLocation(customerLocation)
customerName := "Jordan Miller"
requestBody.SetCustomerName(&customerName)
customerNotes := "Please be on time."
requestBody.SetCustomerNotes(&customerNotes)
customerPhone := "213-555-0199"
requestBody.SetCustomerPhone(&customerPhone)
customerTimeZone := "America/Chicago"
requestBody.SetCustomerTimeZone(&customerTimeZone)
smsNotificationsEnabled := true
requestBody.SetSmsNotificationsEnabled(&smsNotificationsEnabled)
end := graphmodels.NewDateTimeTimeZone()
dateTime := "2018-05-01T12:30:00.0000000+00:00"
end.SetDateTime(&dateTime)
timeZone := "UTC"
end.SetTimeZone(&timeZone)
requestBody.SetEnd(end)
invoiceAmount := float64(10)
requestBody.SetInvoiceAmount(&invoiceAmount)
invoiceDate := graphmodels.NewDateTimeTimeZone()
dateTime := "2018-05-01T12:30:00.0000000+00:00"
invoiceDate.SetDateTime(&dateTime)
timeZone := "UTC"
invoiceDate.SetTimeZone(&timeZone)
requestBody.SetInvoiceDate(invoiceDate)
invoiceId := "1001"
requestBody.SetInvoiceId(&invoiceId)
invoiceStatus := graphmodels.OPEN_BOOKINGINVOICESTATUS
requestBody.SetInvoiceStatus(&invoiceStatus)
isCustomerAllowedToManageBooking := true
requestBody.SetIsCustomerAllowedToManageBooking(&isCustomerAllowedToManageBooking)
invoiceUrl := "theInvoiceUrl"
requestBody.SetInvoiceUrl(&invoiceUrl)
isLocationOnline := true
requestBody.SetIsLocationOnline(&isLocationOnline)
optOutOfCustomerEmail := false
requestBody.SetOptOutOfCustomerEmail(&optOutOfCustomerEmail)
anonymousJoinWebUrl := null
requestBody.SetAnonymousJoinWebUrl(&anonymousJoinWebUrl)
postBuffer , err := abstractions.ParseISODuration("PT10M")
requestBody.SetPostBuffer(&postBuffer)
preBuffer , err := abstractions.ParseISODuration("PT5M")
requestBody.SetPreBuffer(&preBuffer)
price := float64(10)
requestBody.SetPrice(&price)
priceType := graphmodels.FIXEDPRICE_BOOKINGPRICETYPE
requestBody.SetPriceType(&priceType)
bookingReminder := graphmodels.NewBookingReminder()
message := "This service is tomorrow"
bookingReminder.SetMessage(&message)
offset , err := abstractions.ParseISODuration("P1D")
bookingReminder.SetOffset(&offset)
recipients := graphmodels.ALLATTENDEES_BOOKINGREMINDERRECIPIENTS
bookingReminder.SetRecipients(&recipients)
additionalData := map[string]interface{}{
"recipients@odata.type" : "#microsoft.graph.bookingReminderRecipients",
}
bookingReminder.SetAdditionalData(additionalData)
bookingReminder1 := graphmodels.NewBookingReminder()
message := "Please be available to enjoy your lunch service."
bookingReminder1.SetMessage(&message)
offset , err := abstractions.ParseISODuration("PT1H")
bookingReminder1.SetOffset(&offset)
recipients := graphmodels.CUSTOMER_BOOKINGREMINDERRECIPIENTS
bookingReminder1.SetRecipients(&recipients)
additionalData := map[string]interface{}{
"recipients@odata.type" : "#microsoft.graph.bookingReminderRecipients",
}
bookingReminder1.SetAdditionalData(additionalData)
bookingReminder2 := graphmodels.NewBookingReminder()
message := "Please check traffic for next cater."
bookingReminder2.SetMessage(&message)
offset , err := abstractions.ParseISODuration("PT2H")
bookingReminder2.SetOffset(&offset)
recipients := graphmodels.STAFF_BOOKINGREMINDERRECIPIENTS
bookingReminder2.SetRecipients(&recipients)
additionalData := map[string]interface{}{
"recipients@odata.type" : "#microsoft.graph.bookingReminderRecipients",
}
bookingReminder2.SetAdditionalData(additionalData)
reminders := []graphmodels.BookingReminderable {
bookingReminder,
bookingReminder1,
bookingReminder2,
}
requestBody.SetReminders(reminders)
serviceId := "57da6774-a087-4d69-b0e6-6fb82c339976"
requestBody.SetServiceId(&serviceId)
serviceLocation := graphmodels.NewLocation()
address := graphmodels.NewPhysicalAddress()
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 := "123 First Avenue"
address.SetStreet(&street)
type := null
address.SetType(&type)
additionalData := map[string]interface{}{
"type@odata.type" : "#microsoft.graph.physicalAddressType",
}
address.SetAdditionalData(additionalData)
serviceLocation.SetAddress(address)
coordinates := null
serviceLocation.SetCoordinates(&coordinates)
displayName := "Customer location"
serviceLocation.SetDisplayName(&displayName)
locationEmailAddress := null
serviceLocation.SetLocationEmailAddress(&locationEmailAddress)
locationType := null
serviceLocation.SetLocationType(&locationType)
locationUri := null
serviceLocation.SetLocationUri(&locationUri)
uniqueId := null
serviceLocation.SetUniqueId(&uniqueId)
uniqueIdType := null
serviceLocation.SetUniqueIdType(&uniqueIdType)
additionalData := map[string]interface{}{
"locationType@odata.type" : "#microsoft.graph.locationType",
"uniqueIdType@odata.type" : "#microsoft.graph.locationUniqueIdType",
}
serviceLocation.SetAdditionalData(additionalData)
requestBody.SetServiceLocation(serviceLocation)
serviceName := "Catered bento"
requestBody.SetServiceName(&serviceName)
serviceNotes := "Customer requires punctual service."
requestBody.SetServiceNotes(&serviceNotes)
start := graphmodels.NewDateTimeTimeZone()
dateTime := "2018-05-01T12:00:00.0000000+00:00"
start.SetDateTime(&dateTime)
timeZone := "UTC"
start.SetTimeZone(&timeZone)
requestBody.SetStart(start)
maximumAttendeesCount := int32(5)
requestBody.SetMaximumAttendeesCount(&maximumAttendeesCount)
filledAttendeesCount := int32(1)
requestBody.SetFilledAttendeesCount(&filledAttendeesCount)
bookingCustomerInformationBase := graphmodels.NewBookingCustomerInformation()
customerId := "7ed53fa5-9ef2-4f2f-975b-27447440bc09"
bookingCustomerInformationBase.SetCustomerId(&customerId)
name := "Jordan Miller"
bookingCustomerInformationBase.SetName(&name)
emailAddress := "jordanm@contoso.com"
bookingCustomerInformationBase.SetEmailAddress(&emailAddress)
phone := "213-555-0199"
bookingCustomerInformationBase.SetPhone(&phone)
notes := null
bookingCustomerInformationBase.SetNotes(¬es)
location := graphmodels.NewLocation()
displayName := "Customer"
location.SetDisplayName(&displayName)
locationEmailAddress := null
location.SetLocationEmailAddress(&locationEmailAddress)
locationUri := ""
location.SetLocationUri(&locationUri)
locationType := null
location.SetLocationType(&locationType)
uniqueId := null
location.SetUniqueId(&uniqueId)
uniqueIdType := null
location.SetUniqueIdType(&uniqueIdType)
address := graphmodels.NewPhysicalAddress()
type := graphmodels.HOME_PHYSICALADDRESSTYPE
address.SetType(&type)
postOfficeBox := ""
address.SetPostOfficeBox(&postOfficeBox)
street := ""
address.SetStreet(&street)
city := ""
address.SetCity(&city)
state := ""
address.SetState(&state)
countryOrRegion := ""
address.SetCountryOrRegion(&countryOrRegion)
postalCode := ""
address.SetPostalCode(&postalCode)
location.SetAddress(address)
coordinates := graphmodels.NewOutlookGeoCoordinates()
altitude := null
coordinates.SetAltitude(&altitude)
latitude := null
coordinates.SetLatitude(&latitude)
longitude := null
coordinates.SetLongitude(&longitude)
accuracy := null
coordinates.SetAccuracy(&accuracy)
altitudeAccuracy := null
coordinates.SetAltitudeAccuracy(&altitudeAccuracy)
location.SetCoordinates(coordinates)
bookingCustomerInformationBase.SetLocation(location)
timeZone := "America/Chicago"
bookingCustomerInformationBase.SetTimeZone(&timeZone)
bookingQuestionAnswer := graphmodels.NewBookingQuestionAnswer()
questionId := "3bc6fde0-4ad3-445d-ab17-0fc15dba0774"
bookingQuestionAnswer.SetQuestionId(&questionId)
question := "What is your age"
bookingQuestionAnswer.SetQuestion(&question)
answerInputType := graphmodels.TEXT_ANSWERINPUTTYPE
bookingQuestionAnswer.SetAnswerInputType(&answerInputType)
answerOptions := []string {
}
bookingQuestionAnswer.SetAnswerOptions(answerOptions)
isRequired := true
bookingQuestionAnswer.SetIsRequired(&isRequired)
answer := "25"
bookingQuestionAnswer.SetAnswer(&answer)
selectedOptions := []string {
}
bookingQuestionAnswer.SetSelectedOptions(selectedOptions)
customQuestionAnswers := []graphmodels.BookingQuestionAnswerable {
bookingQuestionAnswer,
}
bookingCustomerInformationBase.SetCustomQuestionAnswers(customQuestionAnswers)
customers := []graphmodels.BookingCustomerInformationBaseable {
bookingCustomerInformationBase,
}
requestBody.SetCustomers(customers)
additionalData := map[string]interface{}{
"invoiceStatus@odata.type" : "#microsoft.graph.bookingInvoiceStatus",
"priceType@odata.type" : "#microsoft.graph.bookingPriceType",
"reminders@odata.type" : "#Collection(microsoft.graph.bookingReminder)",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
appointments, err := graphClient.Solutions().BookingBusinesses().ByBookingBusinessId("bookingBusiness-id").Appointments().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
BookingAppointment bookingAppointment = new BookingAppointment();
bookingAppointment.setOdataType("#microsoft.graph.bookingAppointment");
bookingAppointment.setCustomerEmailAddress("jordanm@contoso.com");
Location customerLocation = new Location();
customerLocation.setOdataType("#microsoft.graph.location");
PhysicalAddress address = new PhysicalAddress();
address.setOdataType("#microsoft.graph.physicalAddress");
address.setCity("Buffalo");
address.setCountryOrRegion("USA");
address.setPostalCode("98052");
address.setPostOfficeBox(null);
address.setState("NY");
address.setStreet("123 First Avenue");
address.setType(null);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("type@odata.type", "#microsoft.graph.physicalAddressType");
address.setAdditionalData(additionalData);
customerLocation.setAddress(address);
customerLocation.setCoordinates(null);
customerLocation.setDisplayName("Customer");
customerLocation.setLocationEmailAddress(null);
customerLocation.setLocationType(null);
customerLocation.setLocationUri(null);
customerLocation.setUniqueId(null);
customerLocation.setUniqueIdType(null);
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("locationType@odata.type", "#microsoft.graph.locationType");
additionalData1.put("uniqueIdType@odata.type", "#microsoft.graph.locationUniqueIdType");
customerLocation.setAdditionalData(additionalData1);
bookingAppointment.setCustomerLocation(customerLocation);
bookingAppointment.setCustomerName("Jordan Miller");
bookingAppointment.setCustomerNotes("Please be on time.");
bookingAppointment.setCustomerPhone("213-555-0199");
bookingAppointment.setCustomerTimeZone("America/Chicago");
bookingAppointment.setSmsNotificationsEnabled(true);
DateTimeTimeZone end = new DateTimeTimeZone();
end.setOdataType("#microsoft.graph.dateTimeTimeZone");
end.setDateTime("2018-05-01T12:30:00.0000000+00:00");
end.setTimeZone("UTC");
bookingAppointment.setEnd(end);
bookingAppointment.setInvoiceAmount(10d);
DateTimeTimeZone invoiceDate = new DateTimeTimeZone();
invoiceDate.setOdataType("#microsoft.graph.dateTimeTimeZone");
invoiceDate.setDateTime("2018-05-01T12:30:00.0000000+00:00");
invoiceDate.setTimeZone("UTC");
bookingAppointment.setInvoiceDate(invoiceDate);
bookingAppointment.setInvoiceId("1001");
bookingAppointment.setInvoiceStatus(BookingInvoiceStatus.Open);
bookingAppointment.setIsCustomerAllowedToManageBooking(true);
bookingAppointment.setInvoiceUrl("theInvoiceUrl");
bookingAppointment.setIsLocationOnline(true);
bookingAppointment.setOptOutOfCustomerEmail(false);
bookingAppointment.setAnonymousJoinWebUrl(null);
PeriodAndDuration postBuffer = PeriodAndDuration.ofDuration(Duration.parse("PT10M"));
bookingAppointment.setPostBuffer(postBuffer);
PeriodAndDuration preBuffer = PeriodAndDuration.ofDuration(Duration.parse("PT5M"));
bookingAppointment.setPreBuffer(preBuffer);
bookingAppointment.setPrice(10d);
bookingAppointment.setPriceType(BookingPriceType.FixedPrice);
LinkedList<BookingReminder> reminders = new LinkedList<BookingReminder>();
BookingReminder bookingReminder = new BookingReminder();
bookingReminder.setOdataType("#microsoft.graph.bookingReminder");
bookingReminder.setMessage("This service is tomorrow");
PeriodAndDuration offset = PeriodAndDuration.ofDuration(Duration.parse("P1D"));
bookingReminder.setOffset(offset);
bookingReminder.setRecipients(BookingReminderRecipients.AllAttendees);
HashMap<String, Object> additionalData2 = new HashMap<String, Object>();
additionalData2.put("recipients@odata.type", "#microsoft.graph.bookingReminderRecipients");
bookingReminder.setAdditionalData(additionalData2);
reminders.add(bookingReminder);
BookingReminder bookingReminder1 = new BookingReminder();
bookingReminder1.setOdataType("#microsoft.graph.bookingReminder");
bookingReminder1.setMessage("Please be available to enjoy your lunch service.");
PeriodAndDuration offset1 = PeriodAndDuration.ofDuration(Duration.parse("PT1H"));
bookingReminder1.setOffset(offset1);
bookingReminder1.setRecipients(BookingReminderRecipients.Customer);
HashMap<String, Object> additionalData3 = new HashMap<String, Object>();
additionalData3.put("recipients@odata.type", "#microsoft.graph.bookingReminderRecipients");
bookingReminder1.setAdditionalData(additionalData3);
reminders.add(bookingReminder1);
BookingReminder bookingReminder2 = new BookingReminder();
bookingReminder2.setOdataType("#microsoft.graph.bookingReminder");
bookingReminder2.setMessage("Please check traffic for next cater.");
PeriodAndDuration offset2 = PeriodAndDuration.ofDuration(Duration.parse("PT2H"));
bookingReminder2.setOffset(offset2);
bookingReminder2.setRecipients(BookingReminderRecipients.Staff);
HashMap<String, Object> additionalData4 = new HashMap<String, Object>();
additionalData4.put("recipients@odata.type", "#microsoft.graph.bookingReminderRecipients");
bookingReminder2.setAdditionalData(additionalData4);
reminders.add(bookingReminder2);
bookingAppointment.setReminders(reminders);
bookingAppointment.setServiceId("57da6774-a087-4d69-b0e6-6fb82c339976");
Location serviceLocation = new Location();
serviceLocation.setOdataType("#microsoft.graph.location");
PhysicalAddress address1 = new PhysicalAddress();
address1.setOdataType("#microsoft.graph.physicalAddress");
address1.setCity("Buffalo");
address1.setCountryOrRegion("USA");
address1.setPostalCode("98052");
address1.setPostOfficeBox(null);
address1.setState("NY");
address1.setStreet("123 First Avenue");
address1.setType(null);
HashMap<String, Object> additionalData5 = new HashMap<String, Object>();
additionalData5.put("type@odata.type", "#microsoft.graph.physicalAddressType");
address1.setAdditionalData(additionalData5);
serviceLocation.setAddress(address1);
serviceLocation.setCoordinates(null);
serviceLocation.setDisplayName("Customer location");
serviceLocation.setLocationEmailAddress(null);
serviceLocation.setLocationType(null);
serviceLocation.setLocationUri(null);
serviceLocation.setUniqueId(null);
serviceLocation.setUniqueIdType(null);
HashMap<String, Object> additionalData6 = new HashMap<String, Object>();
additionalData6.put("locationType@odata.type", "#microsoft.graph.locationType");
additionalData6.put("uniqueIdType@odata.type", "#microsoft.graph.locationUniqueIdType");
serviceLocation.setAdditionalData(additionalData6);
bookingAppointment.setServiceLocation(serviceLocation);
bookingAppointment.setServiceName("Catered bento");
bookingAppointment.setServiceNotes("Customer requires punctual service.");
DateTimeTimeZone start = new DateTimeTimeZone();
start.setOdataType("#microsoft.graph.dateTimeTimeZone");
start.setDateTime("2018-05-01T12:00:00.0000000+00:00");
start.setTimeZone("UTC");
bookingAppointment.setStart(start);
bookingAppointment.setMaximumAttendeesCount(5);
bookingAppointment.setFilledAttendeesCount(1);
LinkedList<BookingCustomerInformationBase> customers = new LinkedList<BookingCustomerInformationBase>();
BookingCustomerInformation bookingCustomerInformationBase = new BookingCustomerInformation();
bookingCustomerInformationBase.setOdataType("#microsoft.graph.bookingCustomerInformation");
bookingCustomerInformationBase.setCustomerId("7ed53fa5-9ef2-4f2f-975b-27447440bc09");
bookingCustomerInformationBase.setName("Jordan Miller");
bookingCustomerInformationBase.setEmailAddress("jordanm@contoso.com");
bookingCustomerInformationBase.setPhone("213-555-0199");
bookingCustomerInformationBase.setNotes(null);
Location location = new Location();
location.setOdataType("#microsoft.graph.location");
location.setDisplayName("Customer");
location.setLocationEmailAddress(null);
location.setLocationUri("");
location.setLocationType(null);
location.setUniqueId(null);
location.setUniqueIdType(null);
PhysicalAddress address2 = new PhysicalAddress();
address2.setOdataType("#microsoft.graph.physicalAddress");
address2.setType(PhysicalAddressType.Home);
address2.setPostOfficeBox("");
address2.setStreet("");
address2.setCity("");
address2.setState("");
address2.setCountryOrRegion("");
address2.setPostalCode("");
location.setAddress(address2);
OutlookGeoCoordinates coordinates2 = new OutlookGeoCoordinates();
coordinates2.setAltitude(null);
coordinates2.setLatitude(null);
coordinates2.setLongitude(null);
coordinates2.setAccuracy(null);
coordinates2.setAltitudeAccuracy(null);
location.setCoordinates(coordinates2);
bookingCustomerInformationBase.setLocation(location);
bookingCustomerInformationBase.setTimeZone("America/Chicago");
LinkedList<BookingQuestionAnswer> customQuestionAnswers = new LinkedList<BookingQuestionAnswer>();
BookingQuestionAnswer bookingQuestionAnswer = new BookingQuestionAnswer();
bookingQuestionAnswer.setQuestionId("3bc6fde0-4ad3-445d-ab17-0fc15dba0774");
bookingQuestionAnswer.setQuestion("What is your age");
bookingQuestionAnswer.setAnswerInputType(AnswerInputType.Text);
LinkedList<String> answerOptions = new LinkedList<String>();
bookingQuestionAnswer.setAnswerOptions(answerOptions);
bookingQuestionAnswer.setIsRequired(true);
bookingQuestionAnswer.setAnswer("25");
LinkedList<String> selectedOptions = new LinkedList<String>();
bookingQuestionAnswer.setSelectedOptions(selectedOptions);
customQuestionAnswers.add(bookingQuestionAnswer);
bookingCustomerInformationBase.setCustomQuestionAnswers(customQuestionAnswers);
customers.add(bookingCustomerInformationBase);
bookingAppointment.setCustomers(customers);
HashMap<String, Object> additionalData7 = new HashMap<String, Object>();
additionalData7.put("invoiceStatus@odata.type", "#microsoft.graph.bookingInvoiceStatus");
additionalData7.put("priceType@odata.type", "#microsoft.graph.bookingPriceType");
additionalData7.put("reminders@odata.type", "#Collection(microsoft.graph.bookingReminder)");
bookingAppointment.setAdditionalData(additionalData7);
BookingAppointment result = graphClient.solutions().bookingBusinesses().byBookingBusinessId("{bookingBusiness-id}").appointments().post(bookingAppointment);
const options = {
authProvider,
};
const client = Client.init(options);
const bookingAppointment = {
'@odata.type':'#microsoft.graph.bookingAppointment',
customerEmailAddress: 'jordanm@contoso.com',
customerLocation: {
'@odata.type':'#microsoft.graph.location',
address: {
'@odata.type':'#microsoft.graph.physicalAddress',
city: 'Buffalo',
countryOrRegion: 'USA',
postalCode: '98052',
postOfficeBox: null,
state: 'NY',
street: '123 First Avenue',
'type@odata.type':'#microsoft.graph.physicalAddressType',
type: null
},
coordinates: null,
displayName: 'Customer',
locationEmailAddress: null,
'locationType@odata.type':'#microsoft.graph.locationType',
locationType: null,
locationUri: null,
uniqueId: null,
'uniqueIdType@odata.type':'#microsoft.graph.locationUniqueIdType',
uniqueIdType: null
},
customerName: 'Jordan Miller',
customerNotes: 'Please be on time.',
customerPhone: '213-555-0199',
customerTimeZone: 'America/Chicago',
smsNotificationsEnabled: true,
end: {
'@odata.type':'#microsoft.graph.dateTimeTimeZone',
dateTime: '2018-05-01T12:30:00.0000000+00:00',
timeZone: 'UTC'
},
invoiceAmount: 10.0,
invoiceDate: {
'@odata.type':'#microsoft.graph.dateTimeTimeZone',
dateTime: '2018-05-01T12:30:00.0000000+00:00',
timeZone: 'UTC'
},
invoiceId: '1001',
'invoiceStatus@odata.type':'#microsoft.graph.bookingInvoiceStatus',
invoiceStatus: 'open',
isCustomerAllowedToManageBooking: true,
invoiceUrl: 'theInvoiceUrl',
isLocationOnline: true,
optOutOfCustomerEmail: false,
anonymousJoinWebUrl: null,
postBuffer: 'PT10M',
preBuffer: 'PT5M',
price: 10.0,
'priceType@odata.type': '#microsoft.graph.bookingPriceType',
priceType: 'fixedPrice',
'reminders@odata.type': '#Collection(microsoft.graph.bookingReminder)',
reminders: [
{
'@odata.type': '#microsoft.graph.bookingReminder',
message: 'This service is tomorrow',
offset: 'P1D',
'recipients@odata.type': '#microsoft.graph.bookingReminderRecipients',
recipients: 'allAttendees'
},
{
'@odata.type': '#microsoft.graph.bookingReminder',
message: 'Please be available to enjoy your lunch service.',
offset: 'PT1H',
'recipients@odata.type': '#microsoft.graph.bookingReminderRecipients',
recipients: 'customer'
},
{
'@odata.type': '#microsoft.graph.bookingReminder',
message: 'Please check traffic for next cater.',
offset: 'PT2H',
'recipients@odata.type': '#microsoft.graph.bookingReminderRecipients',
recipients: 'staff'
}
],
serviceId: '57da6774-a087-4d69-b0e6-6fb82c339976',
serviceLocation: {
'@odata.type': '#microsoft.graph.location',
address: {
'@odata.type': '#microsoft.graph.physicalAddress',
city: 'Buffalo',
countryOrRegion: 'USA',
postalCode: '98052',
postOfficeBox: null,
state: 'NY',
street: '123 First Avenue',
'type@odata.type': '#microsoft.graph.physicalAddressType',
type: null
},
coordinates: null,
displayName: 'Customer location',
locationEmailAddress: null,
'locationType@odata.type': '#microsoft.graph.locationType',
locationType: null,
locationUri: null,
uniqueId: null,
'uniqueIdType@odata.type': '#microsoft.graph.locationUniqueIdType',
uniqueIdType: null
},
serviceName: 'Catered bento',
serviceNotes: 'Customer requires punctual service.',
start: {
'@odata.type': '#microsoft.graph.dateTimeTimeZone',
dateTime: '2018-05-01T12:00:00.0000000+00:00',
timeZone: 'UTC'
},
maximumAttendeesCount: 5,
filledAttendeesCount: 1,
customers: [
{
'@odata.type': '#microsoft.graph.bookingCustomerInformation',
customerId: '7ed53fa5-9ef2-4f2f-975b-27447440bc09',
name: 'Jordan Miller',
emailAddress: 'jordanm@contoso.com',
phone: '213-555-0199',
notes: null,
location: {
'@odata.type': '#microsoft.graph.location',
displayName: 'Customer',
locationEmailAddress: null,
locationUri: '',
locationType: null,
uniqueId: null,
uniqueIdType: null,
address: {
'@odata.type': '#microsoft.graph.physicalAddress',
type: 'home',
postOfficeBox: '',
street: '',
city: '',
state: '',
countryOrRegion: '',
postalCode: ''
},
coordinates: {
altitude: null,
latitude: null,
longitude: null,
accuracy: null,
altitudeAccuracy: null
}
},
timeZone: 'America/Chicago',
customQuestionAnswers: [
{
questionId: '3bc6fde0-4ad3-445d-ab17-0fc15dba0774',
question: 'What is your age',
answerInputType: 'text',
answerOptions: [],
isRequired: true,
answer: '25',
selectedOptions: []
}
]
}
]
};
await client.api('/solutions/bookingbusinesses/contosolunchdelivery@contoso.com/appointments')
.version('beta')
.post(bookingAppointment);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\BookingAppointment;
use Microsoft\Graph\Beta\Generated\Models\Location;
use Microsoft\Graph\Beta\Generated\Models\PhysicalAddress;
use Microsoft\Graph\Beta\Generated\Models\DateTimeTimeZone;
use Microsoft\Graph\Beta\Generated\Models\BookingInvoiceStatus;
use Microsoft\Graph\Beta\Generated\Models\BookingPriceType;
use Microsoft\Graph\Beta\Generated\Models\BookingReminder;
use Microsoft\Graph\Beta\Generated\Models\BookingReminderRecipients;
use Microsoft\Graph\Beta\Generated\Models\BookingCustomerInformationBase;
use Microsoft\Graph\Beta\Generated\Models\BookingCustomerInformation;
use Microsoft\Graph\Beta\Generated\Models\PhysicalAddressType;
use Microsoft\Graph\Beta\Generated\Models\OutlookGeoCoordinates;
use Microsoft\Graph\Beta\Generated\Models\BookingQuestionAnswer;
use Microsoft\Graph\Beta\Generated\Models\AnswerInputType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new BookingAppointment();
$requestBody->setOdataType('#microsoft.graph.bookingAppointment');
$requestBody->setCustomerEmailAddress('jordanm@contoso.com');
$customerLocation = new Location();
$customerLocation->setOdataType('#microsoft.graph.location');
$customerLocationAddress = new PhysicalAddress();
$customerLocationAddress->setOdataType('#microsoft.graph.physicalAddress');
$customerLocationAddress->setCity('Buffalo');
$customerLocationAddress->setCountryOrRegion('USA');
$customerLocationAddress->setPostalCode('98052');
$customerLocationAddress->setPostOfficeBox(null);
$customerLocationAddress->setState('NY');
$customerLocationAddress->setStreet('123 First Avenue');
$customerLocationAddress->setType(null);
$additionalData = [
'type@odata.type' => '#microsoft.graph.physicalAddressType',
];
$customerLocationAddress->setAdditionalData($additionalData);
$customerLocation->setAddress($customerLocationAddress);
$customerLocation->setCoordinates(null);
$customerLocation->setDisplayName('Customer');
$customerLocation->setLocationEmailAddress(null);
$customerLocation->setLocationType(null);
$customerLocation->setLocationUri(null);
$customerLocation->setUniqueId(null);
$customerLocation->setUniqueIdType(null);
$additionalData = [
'locationType@odata.type' => '#microsoft.graph.locationType',
'uniqueIdType@odata.type' => '#microsoft.graph.locationUniqueIdType',
];
$customerLocation->setAdditionalData($additionalData);
$requestBody->setCustomerLocation($customerLocation);
$requestBody->setCustomerName('Jordan Miller');
$requestBody->setCustomerNotes('Please be on time.');
$requestBody->setCustomerPhone('213-555-0199');
$requestBody->setCustomerTimeZone('America/Chicago');
$requestBody->setSmsNotificationsEnabled(true);
$end = new DateTimeTimeZone();
$end->setOdataType('#microsoft.graph.dateTimeTimeZone');
$end->setDateTime('2018-05-01T12:30:00.0000000+00:00');
$end->setTimeZone('UTC');
$requestBody->setEnd($end);
$requestBody->setInvoiceAmount(10);
$invoiceDate = new DateTimeTimeZone();
$invoiceDate->setOdataType('#microsoft.graph.dateTimeTimeZone');
$invoiceDate->setDateTime('2018-05-01T12:30:00.0000000+00:00');
$invoiceDate->setTimeZone('UTC');
$requestBody->setInvoiceDate($invoiceDate);
$requestBody->setInvoiceId('1001');
$requestBody->setInvoiceStatus(new BookingInvoiceStatus('open'));
$requestBody->setIsCustomerAllowedToManageBooking(true);
$requestBody->setInvoiceUrl('theInvoiceUrl');
$requestBody->setIsLocationOnline(true);
$requestBody->setOptOutOfCustomerEmail(false);
$requestBody->setAnonymousJoinWebUrl(null);
$requestBody->setPostBuffer(new \DateInterval('PT10M'));
$requestBody->setPreBuffer(new \DateInterval('PT5M'));
$requestBody->setPrice(10);
$requestBody->setPriceType(new BookingPriceType('fixedPrice'));
$remindersBookingReminder1 = new BookingReminder();
$remindersBookingReminder1->setOdataType('#microsoft.graph.bookingReminder');
$remindersBookingReminder1->setMessage('This service is tomorrow');
$remindersBookingReminder1->setOffset(new \DateInterval('P1D'));
$remindersBookingReminder1->setRecipients(new BookingReminderRecipients('allAttendees'));
$additionalData = [
'recipients@odata.type' => '#microsoft.graph.bookingReminderRecipients',
];
$remindersBookingReminder1->setAdditionalData($additionalData);
$remindersArray []= $remindersBookingReminder1;
$remindersBookingReminder2 = new BookingReminder();
$remindersBookingReminder2->setOdataType('#microsoft.graph.bookingReminder');
$remindersBookingReminder2->setMessage('Please be available to enjoy your lunch service.');
$remindersBookingReminder2->setOffset(new \DateInterval('PT1H'));
$remindersBookingReminder2->setRecipients(new BookingReminderRecipients('customer'));
$additionalData = [
'recipients@odata.type' => '#microsoft.graph.bookingReminderRecipients',
];
$remindersBookingReminder2->setAdditionalData($additionalData);
$remindersArray []= $remindersBookingReminder2;
$remindersBookingReminder3 = new BookingReminder();
$remindersBookingReminder3->setOdataType('#microsoft.graph.bookingReminder');
$remindersBookingReminder3->setMessage('Please check traffic for next cater.');
$remindersBookingReminder3->setOffset(new \DateInterval('PT2H'));
$remindersBookingReminder3->setRecipients(new BookingReminderRecipients('staff'));
$additionalData = [
'recipients@odata.type' => '#microsoft.graph.bookingReminderRecipients',
];
$remindersBookingReminder3->setAdditionalData($additionalData);
$remindersArray []= $remindersBookingReminder3;
$requestBody->setReminders($remindersArray);
$requestBody->setServiceId('57da6774-a087-4d69-b0e6-6fb82c339976');
$serviceLocation = new Location();
$serviceLocation->setOdataType('#microsoft.graph.location');
$serviceLocationAddress = new PhysicalAddress();
$serviceLocationAddress->setOdataType('#microsoft.graph.physicalAddress');
$serviceLocationAddress->setCity('Buffalo');
$serviceLocationAddress->setCountryOrRegion('USA');
$serviceLocationAddress->setPostalCode('98052');
$serviceLocationAddress->setPostOfficeBox(null);
$serviceLocationAddress->setState('NY');
$serviceLocationAddress->setStreet('123 First Avenue');
$serviceLocationAddress->setType(null);
$additionalData = [
'type@odata.type' => '#microsoft.graph.physicalAddressType',
];
$serviceLocationAddress->setAdditionalData($additionalData);
$serviceLocation->setAddress($serviceLocationAddress);
$serviceLocation->setCoordinates(null);
$serviceLocation->setDisplayName('Customer location');
$serviceLocation->setLocationEmailAddress(null);
$serviceLocation->setLocationType(null);
$serviceLocation->setLocationUri(null);
$serviceLocation->setUniqueId(null);
$serviceLocation->setUniqueIdType(null);
$additionalData = [
'locationType@odata.type' => '#microsoft.graph.locationType',
'uniqueIdType@odata.type' => '#microsoft.graph.locationUniqueIdType',
];
$serviceLocation->setAdditionalData($additionalData);
$requestBody->setServiceLocation($serviceLocation);
$requestBody->setServiceName('Catered bento');
$requestBody->setServiceNotes('Customer requires punctual service.');
$start = new DateTimeTimeZone();
$start->setOdataType('#microsoft.graph.dateTimeTimeZone');
$start->setDateTime('2018-05-01T12:00:00.0000000+00:00');
$start->setTimeZone('UTC');
$requestBody->setStart($start);
$requestBody->setMaximumAttendeesCount(5);
$requestBody->setFilledAttendeesCount(1);
$customersBookingCustomerInformationBase1 = new BookingCustomerInformation();
$customersBookingCustomerInformationBase1->setOdataType('#microsoft.graph.bookingCustomerInformation');
$customersBookingCustomerInformationBase1->setCustomerId('7ed53fa5-9ef2-4f2f-975b-27447440bc09');
$customersBookingCustomerInformationBase1->setName('Jordan Miller');
$customersBookingCustomerInformationBase1->setEmailAddress('jordanm@contoso.com');
$customersBookingCustomerInformationBase1->setPhone('213-555-0199');
$customersBookingCustomerInformationBase1->setNotes(null);
$customersBookingCustomerInformationBase1Location = new Location();
$customersBookingCustomerInformationBase1Location->setOdataType('#microsoft.graph.location');
$customersBookingCustomerInformationBase1Location->setDisplayName('Customer');
$customersBookingCustomerInformationBase1Location->setLocationEmailAddress(null);
$customersBookingCustomerInformationBase1Location->setLocationUri('');
$customersBookingCustomerInformationBase1Location->setLocationType(null);
$customersBookingCustomerInformationBase1Location->setUniqueId(null);
$customersBookingCustomerInformationBase1Location->setUniqueIdType(null);
$customersBookingCustomerInformationBase1LocationAddress = new PhysicalAddress();
$customersBookingCustomerInformationBase1LocationAddress->setOdataType('#microsoft.graph.physicalAddress');
$customersBookingCustomerInformationBase1LocationAddress->setType(new PhysicalAddressType('home'));
$customersBookingCustomerInformationBase1LocationAddress->setPostOfficeBox('');
$customersBookingCustomerInformationBase1LocationAddress->setStreet('');
$customersBookingCustomerInformationBase1LocationAddress->setCity('');
$customersBookingCustomerInformationBase1LocationAddress->setState('');
$customersBookingCustomerInformationBase1LocationAddress->setCountryOrRegion('');
$customersBookingCustomerInformationBase1LocationAddress->setPostalCode('');
$customersBookingCustomerInformationBase1Location->setAddress($customersBookingCustomerInformationBase1LocationAddress);
$customersBookingCustomerInformationBase1LocationCoordinates = new OutlookGeoCoordinates();
$customersBookingCustomerInformationBase1LocationCoordinates->setAltitude(null);
$customersBookingCustomerInformationBase1LocationCoordinates->setLatitude(null);
$customersBookingCustomerInformationBase1LocationCoordinates->setLongitude(null);
$customersBookingCustomerInformationBase1LocationCoordinates->setAccuracy(null);
$customersBookingCustomerInformationBase1LocationCoordinates->setAltitudeAccuracy(null);
$customersBookingCustomerInformationBase1Location->setCoordinates($customersBookingCustomerInformationBase1LocationCoordinates);
$customersBookingCustomerInformationBase1->setLocation($customersBookingCustomerInformationBase1Location);
$customersBookingCustomerInformationBase1->setTimeZone('America/Chicago');
$customQuestionAnswersBookingQuestionAnswer1 = new BookingQuestionAnswer();
$customQuestionAnswersBookingQuestionAnswer1->setQuestionId('3bc6fde0-4ad3-445d-ab17-0fc15dba0774');
$customQuestionAnswersBookingQuestionAnswer1->setQuestion('What is your age');
$customQuestionAnswersBookingQuestionAnswer1->setAnswerInputType(new AnswerInputType('text'));
$customQuestionAnswersBookingQuestionAnswer1->setAnswerOptions([]);
$customQuestionAnswersBookingQuestionAnswer1->setIsRequired(true);
$customQuestionAnswersBookingQuestionAnswer1->setAnswer('25');
$customQuestionAnswersBookingQuestionAnswer1->setSelectedOptions([]);
$customQuestionAnswersArray []= $customQuestionAnswersBookingQuestionAnswer1;
$customersBookingCustomerInformationBase1->setCustomQuestionAnswers($customQuestionAnswersArray);
$customersArray []= $customersBookingCustomerInformationBase1;
$requestBody->setCustomers($customersArray);
$additionalData = [
'invoiceStatus@odata.type' => '#microsoft.graph.bookingInvoiceStatus',
'priceType@odata.type' => '#microsoft.graph.bookingPriceType',
'reminders@odata.type' => '#Collection(microsoft.graph.bookingReminder)',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->solutions()->bookingBusinesses()->byBookingBusinessId('bookingBusiness-id')->appointments()->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_appointment import BookingAppointment
from msgraph_beta.generated.models.location import Location
from msgraph_beta.generated.models.physical_address import PhysicalAddress
from msgraph_beta.generated.models.date_time_time_zone import DateTimeTimeZone
from msgraph_beta.generated.models.booking_invoice_status import BookingInvoiceStatus
from msgraph_beta.generated.models.booking_price_type import BookingPriceType
from msgraph_beta.generated.models.booking_reminder import BookingReminder
from msgraph_beta.generated.models.booking_reminder_recipients import BookingReminderRecipients
from msgraph_beta.generated.models.booking_customer_information_base import BookingCustomerInformationBase
from msgraph_beta.generated.models.booking_customer_information import BookingCustomerInformation
from msgraph_beta.generated.models.physical_address_type import PhysicalAddressType
from msgraph_beta.generated.models.outlook_geo_coordinates import OutlookGeoCoordinates
from msgraph_beta.generated.models.booking_question_answer import BookingQuestionAnswer
from msgraph_beta.generated.models.answer_input_type import AnswerInputType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = BookingAppointment(
odata_type = "#microsoft.graph.bookingAppointment",
customer_email_address = "jordanm@contoso.com",
customer_location = Location(
odata_type = "#microsoft.graph.location",
address = PhysicalAddress(
odata_type = "#microsoft.graph.physicalAddress",
city = "Buffalo",
country_or_region = "USA",
postal_code = "98052",
post_office_box = None,
state = "NY",
street = "123 First Avenue",
type = None,
additional_data = {
"type@odata_type" : "#microsoft.graph.physicalAddressType",
}
),
coordinates = None,
display_name = "Customer",
location_email_address = None,
location_type = None,
location_uri = None,
unique_id = None,
unique_id_type = None,
additional_data = {
"location_type@odata_type" : "#microsoft.graph.locationType",
"unique_id_type@odata_type" : "#microsoft.graph.locationUniqueIdType",
}
),
customer_name = "Jordan Miller",
customer_notes = "Please be on time.",
customer_phone = "213-555-0199",
customer_time_zone = "America/Chicago",
sms_notifications_enabled = True,
end = DateTimeTimeZone(
odata_type = "#microsoft.graph.dateTimeTimeZone",
date_time = "2018-05-01T12:30:00.0000000+00:00",
time_zone = "UTC",
),
invoice_amount = 10,
invoice_date = DateTimeTimeZone(
odata_type = "#microsoft.graph.dateTimeTimeZone",
date_time = "2018-05-01T12:30:00.0000000+00:00",
time_zone = "UTC",
),
invoice_id = "1001",
invoice_status = BookingInvoiceStatus.Open,
is_customer_allowed_to_manage_booking = True,
invoice_url = "theInvoiceUrl",
is_location_online = True,
opt_out_of_customer_email = False,
anonymous_join_web_url = None,
post_buffer = "PT10M",
pre_buffer = "PT5M",
price = 10,
price_type = BookingPriceType.FixedPrice,
reminders = [
BookingReminder(
odata_type = "#microsoft.graph.bookingReminder",
message = "This service is tomorrow",
offset = "P1D",
recipients = BookingReminderRecipients.AllAttendees,
additional_data = {
"recipients@odata_type" : "#microsoft.graph.bookingReminderRecipients",
}
),
BookingReminder(
odata_type = "#microsoft.graph.bookingReminder",
message = "Please be available to enjoy your lunch service.",
offset = "PT1H",
recipients = BookingReminderRecipients.Customer,
additional_data = {
"recipients@odata_type" : "#microsoft.graph.bookingReminderRecipients",
}
),
BookingReminder(
odata_type = "#microsoft.graph.bookingReminder",
message = "Please check traffic for next cater.",
offset = "PT2H",
recipients = BookingReminderRecipients.Staff,
additional_data = {
"recipients@odata_type" : "#microsoft.graph.bookingReminderRecipients",
}
),
],
service_id = "57da6774-a087-4d69-b0e6-6fb82c339976",
service_location = Location(
odata_type = "#microsoft.graph.location",
address = PhysicalAddress(
odata_type = "#microsoft.graph.physicalAddress",
city = "Buffalo",
country_or_region = "USA",
postal_code = "98052",
post_office_box = None,
state = "NY",
street = "123 First Avenue",
type = None,
additional_data = {
"type@odata_type" : "#microsoft.graph.physicalAddressType",
}
),
coordinates = None,
display_name = "Customer location",
location_email_address = None,
location_type = None,
location_uri = None,
unique_id = None,
unique_id_type = None,
additional_data = {
"location_type@odata_type" : "#microsoft.graph.locationType",
"unique_id_type@odata_type" : "#microsoft.graph.locationUniqueIdType",
}
),
service_name = "Catered bento",
service_notes = "Customer requires punctual service.",
start = DateTimeTimeZone(
odata_type = "#microsoft.graph.dateTimeTimeZone",
date_time = "2018-05-01T12:00:00.0000000+00:00",
time_zone = "UTC",
),
maximum_attendees_count = 5,
filled_attendees_count = 1,
customers = [
BookingCustomerInformation(
odata_type = "#microsoft.graph.bookingCustomerInformation",
customer_id = "7ed53fa5-9ef2-4f2f-975b-27447440bc09",
name = "Jordan Miller",
email_address = "jordanm@contoso.com",
phone = "213-555-0199",
notes = None,
location = Location(
odata_type = "#microsoft.graph.location",
display_name = "Customer",
location_email_address = None,
location_uri = "",
location_type = None,
unique_id = None,
unique_id_type = None,
address = PhysicalAddress(
odata_type = "#microsoft.graph.physicalAddress",
type = PhysicalAddressType.Home,
post_office_box = "",
street = "",
city = "",
state = "",
country_or_region = "",
postal_code = "",
),
coordinates = OutlookGeoCoordinates(
altitude = None,
latitude = None,
longitude = None,
accuracy = None,
altitude_accuracy = None,
),
),
time_zone = "America/Chicago",
custom_question_answers = [
BookingQuestionAnswer(
question_id = "3bc6fde0-4ad3-445d-ab17-0fc15dba0774",
question = "What is your age",
answer_input_type = AnswerInputType.Text,
answer_options = [
],
is_required = True,
answer = "25",
selected_options = [
],
),
],
),
],
additional_data = {
"invoice_status@odata_type" : "#microsoft.graph.bookingInvoiceStatus",
"price_type@odata_type" : "#microsoft.graph.bookingPriceType",
"reminders@odata_type" : "#Collection(microsoft.graph.bookingReminder)",
}
)
result = await graph_client.solutions.booking_businesses.by_booking_business_id('bookingBusiness-id').appointments.post(request_body)
The following example shows the response.