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. This appointment does not involve booking specific staff members.
POST https://graph.microsoft.com/beta/bookingBusinesses/contosolunchdelivery@contoso.onmicrosoft.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",
"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
var graphClient = new GraphServiceClient(requestAdapter);
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,
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 BookingCustomerInformationBase
{
OdataType = "#microsoft.graph.bookingCustomerInformation",
AdditionalData = new Dictionary<string, object>
{
{
"customerId" , "7ed53fa5-9ef2-4f2f-975b-27447440bc09"
},
{
"name" , "Jordan Miller"
},
{
"emailAddress" , "jordanm@contoso.com"
},
{
"phone" , "213-555-0199"
},
{
"notes" , null
},
{
"location" , new
{
OdataType = "#microsoft.graph.location",
DisplayName = "Customer",
LocationEmailAddress = null,
LocationUri = "",
LocationType = null,
UniqueId = null,
UniqueIdType = null,
Address = new
{
OdataType = "#microsoft.graph.physicalAddress",
Type = "home",
PostOfficeBox = "",
Street = "",
City = "",
State = "",
CountryOrRegion = "",
PostalCode = "",
},
Coordinates = new
{
Altitude = null,
Latitude = null,
Longitude = null,
Accuracy = null,
AltitudeAccuracy = null,
},
}
},
{
"timeZone" , "America/Chicago"
},
{
"customQuestionAnswers" , new List<>
{
new
{
QuestionId = "3bc6fde0-4ad3-445d-ab17-0fc15dba0774",
Question = "What is your age",
AnswerInputType = "text",
AnswerOptions = new List<>
{
},
IsRequired = true,
Answer = "25",
SelectedOptions = new List<>
{
},
},
}
},
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"invoiceStatus@odata.type" , "#microsoft.graph.bookingInvoiceStatus"
},
{
"priceType@odata.type" , "#microsoft.graph.bookingPriceType"
},
{
"reminders@odata.type" , "#Collection(microsoft.graph.bookingReminder)"
},
},
};
var result = await graphClient.BookingBusinesses["{bookingBusiness-id}"].Appointments.PostAsync(requestBody);
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
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
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{}{
"odataType" : "#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{}{
"odataType" : "#microsoft.graph.locationType",
"odataType" : "#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)
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{}{
"odataType" : "#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{}{
"odataType" : "#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{}{
"odataType" : "#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{}{
"odataType" : "#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{}{
"odataType" : "#microsoft.graph.locationType",
"odataType" : "#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.NewBookingCustomerInformationBase()
additionalData := map[string]interface{}{
"customerId" : "7ed53fa5-9ef2-4f2f-975b-27447440bc09",
"name" : "Jordan Miller",
"emailAddress" : "jordanm@contoso.com",
"phone" : "213-555-0199",
notes := null
bookingCustomerInformationBase.SetNotes(¬es)
location := graphmodels.New()
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.New()
type := "home"
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.New()
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",
:= graphmodels.New()
questionId := "3bc6fde0-4ad3-445d-ab17-0fc15dba0774"
.SetQuestionId(&questionId)
question := "What is your age"
.SetQuestion(&question)
answerInputType := "text"
.SetAnswerInputType(&answerInputType)
answerOptions := []graphmodels.able {
}
.SetAnswerOptions(answerOptions)
isRequired := true
.SetIsRequired(&isRequired)
answer := "25"
.SetAnswer(&answer)
selectedOptions := []graphmodels.able {
}
.SetSelectedOptions(selectedOptions)
customQuestionAnswers := []graphmodels.Objectable {
,
}
}
bookingCustomerInformationBase.SetAdditionalData(additionalData)
customers := []graphmodels.BookingCustomerInformationBaseable {
bookingCustomerInformationBase,
}
requestBody.SetCustomers(customers)
additionalData := map[string]interface{}{
"odataType" : "#microsoft.graph.bookingInvoiceStatus",
"odataType" : "#microsoft.graph.bookingPriceType",
"odataType" : "#Collection(microsoft.graph.bookingReminder)",
}
requestBody.SetAdditionalData(additionalData)
result, err := graphClient.BookingBusinesses().ByBookingBusinesseId("bookingBusiness-id").Appointments().Post(context.Background(), requestBody, nil)
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
BookingAppointment bookingAppointment = new BookingAppointment();
bookingAppointment.customerEmailAddress = "jordanm@contoso.com";
Location customerLocation = new Location();
PhysicalAddress address = new PhysicalAddress();
address.city = "Buffalo";
address.countryOrRegion = "USA";
address.postalCode = "98052";
address.postOfficeBox = null;
address.state = "NY";
address.street = "123 First Avenue";
address.additionalDataManager().put("type@odata.type", new JsonPrimitive("#microsoft.graph.physicalAddressType"));
address.type = null;
customerLocation.address = address;
customerLocation.coordinates = null;
customerLocation.displayName = "Customer";
customerLocation.locationEmailAddress = null;
customerLocation.additionalDataManager().put("locationType@odata.type", new JsonPrimitive("#microsoft.graph.locationType"));
customerLocation.locationType = null;
customerLocation.locationUri = null;
customerLocation.uniqueId = null;
customerLocation.additionalDataManager().put("uniqueIdType@odata.type", new JsonPrimitive("#microsoft.graph.locationUniqueIdType"));
customerLocation.uniqueIdType = null;
bookingAppointment.customerLocation = customerLocation;
bookingAppointment.customerName = "Jordan Miller";
bookingAppointment.customerNotes = "Please be on time.";
bookingAppointment.customerPhone = "213-555-0199";
bookingAppointment.customerTimeZone = "America/Chicago";
bookingAppointment.smsNotificationsEnabled = true;
DateTimeTimeZone end = new DateTimeTimeZone();
end.dateTime = "2018-05-01T12:30:00+00:00";
end.timeZone = "UTC";
bookingAppointment.end = end;
bookingAppointment.invoiceAmount = 10.0d;
DateTimeTimeZone invoiceDate = new DateTimeTimeZone();
invoiceDate.dateTime = "2018-05-01T12:30:00+00:00";
invoiceDate.timeZone = "UTC";
bookingAppointment.invoiceDate = invoiceDate;
bookingAppointment.invoiceId = "1001";
bookingAppointment.additionalDataManager().put("invoiceStatus@odata.type", new JsonPrimitive("#microsoft.graph.bookingInvoiceStatus"));
bookingAppointment.invoiceStatus = BookingInvoiceStatus.OPEN;
bookingAppointment.invoiceUrl = "theInvoiceUrl";
bookingAppointment.isLocationOnline = true;
bookingAppointment.optOutOfCustomerEmail = false;
bookingAppointment.anonymousJoinWebUrl = null;
bookingAppointment.postBuffer = DatatypeFactory.newInstance().newDuration("PT10M");
bookingAppointment.preBuffer = DatatypeFactory.newInstance().newDuration("PT5M");
bookingAppointment.price = 10.0d;
bookingAppointment.additionalDataManager().put("priceType@odata.type", new JsonPrimitive("#microsoft.graph.bookingPriceType"));
bookingAppointment.priceType = BookingPriceType.FIXED_PRICE;
bookingAppointment.additionalDataManager().put("reminders@odata.type", new JsonPrimitive("#Collection(microsoft.graph.bookingReminder)"));
LinkedList<BookingReminder> remindersList = new LinkedList<BookingReminder>();
BookingReminder reminders = new BookingReminder();
reminders.message = "This service is tomorrow";
reminders.offset = DatatypeFactory.newInstance().newDuration("P1D");
reminders.additionalDataManager().put("recipients@odata.type", new JsonPrimitive("#microsoft.graph.bookingReminderRecipients"));
reminders.recipients = BookingReminderRecipients.ALL_ATTENDEES;
remindersList.add(reminders);
BookingReminder reminders1 = new BookingReminder();
reminders1.message = "Please be available to enjoy your lunch service.";
reminders1.offset = DatatypeFactory.newInstance().newDuration("PT1H");
reminders1.additionalDataManager().put("recipients@odata.type", new JsonPrimitive("#microsoft.graph.bookingReminderRecipients"));
reminders1.recipients = BookingReminderRecipients.CUSTOMER;
remindersList.add(reminders1);
BookingReminder reminders2 = new BookingReminder();
reminders2.message = "Please check traffic for next cater.";
reminders2.offset = DatatypeFactory.newInstance().newDuration("PT2H");
reminders2.additionalDataManager().put("recipients@odata.type", new JsonPrimitive("#microsoft.graph.bookingReminderRecipients"));
reminders2.recipients = BookingReminderRecipients.STAFF;
remindersList.add(reminders2);
bookingAppointment.reminders = remindersList;
bookingAppointment.serviceId = "57da6774-a087-4d69-b0e6-6fb82c339976";
Location serviceLocation = new Location();
PhysicalAddress address1 = new PhysicalAddress();
address1.city = "Buffalo";
address1.countryOrRegion = "USA";
address1.postalCode = "98052";
address1.postOfficeBox = null;
address1.state = "NY";
address1.street = "123 First Avenue";
address1.additionalDataManager().put("type@odata.type", new JsonPrimitive("#microsoft.graph.physicalAddressType"));
address1.type = null;
serviceLocation.address = address1;
serviceLocation.coordinates = null;
serviceLocation.displayName = "Customer location";
serviceLocation.locationEmailAddress = null;
serviceLocation.additionalDataManager().put("locationType@odata.type", new JsonPrimitive("#microsoft.graph.locationType"));
serviceLocation.locationType = null;
serviceLocation.locationUri = null;
serviceLocation.uniqueId = null;
serviceLocation.additionalDataManager().put("uniqueIdType@odata.type", new JsonPrimitive("#microsoft.graph.locationUniqueIdType"));
serviceLocation.uniqueIdType = null;
bookingAppointment.serviceLocation = serviceLocation;
bookingAppointment.serviceName = "Catered bento";
bookingAppointment.serviceNotes = "Customer requires punctual service.";
DateTimeTimeZone start = new DateTimeTimeZone();
start.dateTime = "2018-05-01T12:00:00+00:00";
start.timeZone = "UTC";
bookingAppointment.start = start;
bookingAppointment.maximumAttendeesCount = 5;
bookingAppointment.filledAttendeesCount = 1;
LinkedList<BookingCustomerInformationBase> customersList = new LinkedList<BookingCustomerInformationBase>();
BookingCustomerInformation customers = new BookingCustomerInformation();
customers.customerId = "7ed53fa5-9ef2-4f2f-975b-27447440bc09";
customers.name = "Jordan Miller";
customers.emailAddress = "jordanm@contoso.com";
customers.phone = "213-555-0199";
customers.notes = null;
Location location = new Location();
location.displayName = "Customer";
location.locationEmailAddress = null;
location.locationUri = "";
location.locationType = null;
location.uniqueId = null;
location.uniqueIdType = null;
PhysicalAddress address2 = new PhysicalAddress();
address2.type = PhysicalAddressType.HOME;
address2.postOfficeBox = "";
address2.street = "";
address2.city = "";
address2.state = "";
address2.countryOrRegion = "";
address2.postalCode = "";
location.address = address2;
OutlookGeoCoordinates coordinates2 = new OutlookGeoCoordinates();
coordinates2.altitude = 0d;
coordinates2.latitude = 0d;
coordinates2.longitude = 0d;
coordinates2.accuracy = 0d;
coordinates2.altitudeAccuracy = 0d;
location.coordinates = coordinates2;
customers.location = location;
customers.timeZone = "America/Chicago";
LinkedList<BookingQuestionAnswer> customQuestionAnswersList = new LinkedList<BookingQuestionAnswer>();
BookingQuestionAnswer customQuestionAnswers = new BookingQuestionAnswer();
customQuestionAnswers.questionId = "3bc6fde0-4ad3-445d-ab17-0fc15dba0774";
customQuestionAnswers.question = "What is your age";
customQuestionAnswers.answerInputType = AnswerInputType.TEXT;
LinkedList<String> answerOptionsList = new LinkedList<String>();
customQuestionAnswers.answerOptions = answerOptionsList;
customQuestionAnswers.isRequired = true;
customQuestionAnswers.answer = "25";
LinkedList<String> selectedOptionsList = new LinkedList<String>();
customQuestionAnswers.selectedOptions = selectedOptionsList;
customQuestionAnswersList.add(customQuestionAnswers);
customers.customQuestionAnswers = customQuestionAnswersList;
customersList.add(customers);
bookingAppointment.customers = customersList;
graphClient.bookingBusinesses("contosolunchdelivery@contoso.onmicrosoft.com").appointments()
.buildRequest()
.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',
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('/bookingBusinesses/contosolunchdelivery@contoso.onmicrosoft.com/appointments')
.version('beta')
.post(bookingAppointment);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new BookingAppointment();
$requestBody->set@odatatype('#microsoft.graph.bookingAppointment');
$requestBody->setCustomerEmailAddress('jordanm@contoso.com');
$customerLocation = new Location();
$customerLocation->set@odatatype('#microsoft.graph.location');
$customerLocationAddress = new PhysicalAddress();
$customerLocationAddress->set@odatatype('#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->set@odatatype('#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->set@odatatype('#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->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->set@odatatype('#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->set@odatatype('#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->set@odatatype('#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->set@odatatype('#microsoft.graph.location');
$serviceLocationAddress = new PhysicalAddress();
$serviceLocationAddress->set@odatatype('#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->set@odatatype('#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 BookingCustomerInformationBase();
$customersBookingCustomerInformationBase1->set@odatatype('#microsoft.graph.bookingCustomerInformation');
$additionalData = [
'customerId' => '7ed53fa5-9ef2-4f2f-975b-27447440bc09',
'name' => 'Jordan Miller',
'emailAddress' => 'jordanm@contoso.com',
'phone' => '213-555-0199',
'notes' => null,
'location' => $customersBookingCustomerInformationBase1 = new Location();
$ customersBookingCustomerInformationBase1->set@odatatype('#microsoft.graph.location');
$ customersBookingCustomerInformationBase1->setDisplayName('Customer');
$customersBookingCustomerInformationBase1->setLocationEmailAddress(null);
$ customersBookingCustomerInformationBase1->setLocationUri('');
$customersBookingCustomerInformationBase1->setLocationType(null);
$customersBookingCustomerInformationBase1->setUniqueId(null);
$customersBookingCustomerInformationBase1->setUniqueIdType(null);
$address = new Address();
$ address->set@odatatype('#microsoft.graph.physicalAddress');
$ address->setType('home');
$ address->setPostOfficeBox('');
$ address->setStreet('');
$ address->setCity('');
$ address->setState('');
$ address->setCountryOrRegion('');
$ address->setPostalCode('');
$customersBookingCustomerInformationBase1->setAddress($address);
$coordinates = new Coordinates();
$Coordinates->setAltitude(null);
$Coordinates->setLatitude(null);
$Coordinates->setLongitude(null);
$Coordinates->setAccuracy(null);
$Coordinates->setAltitudeAccuracy(null);
$customersBookingCustomerInformationBase1->setCoordinates($coordinates);
$customersBookingCustomerInformationBase1->setLocation($location);
'timeZone' => 'America/Chicago',
'customQuestionAnswers' => $customQuestionAnswers1 = new ();
$ customQuestionAnswers1->setQuestionId('3bc6fde0-4ad3-445d-ab17-0fc15dba0774');
$ customQuestionAnswers1->setQuestion('What is your age');
$ customQuestionAnswers1->setAnswerInputType('text');
$customQuestionAnswers1->setAnswerOptions([]);
$customQuestionAnswers1->setIsRequired(true);
$customQuestionAnswers1->setAnswer('25');
$customQuestionAnswers1->setSelectedOptions([]);
$customQuestionAnswersArray []= $customQuestionAnswers1;
$customersBookingCustomerInformationBase1->setCustomQuestionAnswers($customQuestionAnswersArray);
];
$customersBookingCustomerInformationBase1->setAdditionalData($additionalData);
$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->bookingBusinesses()->byBookingBusinesseId('bookingBusiness-id')->appointments()->post($requestBody);
The following is an example of the response.