Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie im Artikel zum Thema Berechtigungen.
Nachfolgend sehen Sie ein Beispiel der Anforderung. Dieser Termin beinhaltet nicht die Buchung bestimmter Mitarbeiter.
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": []
}
]
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var bookingAppointment = new BookingAppointment
{
CustomerEmailAddress = "jordanm@contoso.com",
CustomerLocation = new Location
{
Address = new 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
{
DateTime = "2018-05-01T12:30:00+00:00",
TimeZone = "UTC"
},
InvoiceAmount = 10,
InvoiceDate = new DateTimeTimeZone
{
DateTime = "2018-05-01T12:30:00+00:00",
TimeZone = "UTC"
},
InvoiceId = "1001",
InvoiceStatus = BookingInvoiceStatus.Open,
InvoiceUrl = "theInvoiceUrl",
IsLocationOnline = true,
OptOutOfCustomerEmail = false,
AnonymousJoinWebUrl = null,
PostBuffer = new Duration("PT10M"),
PreBuffer = new Duration("PT5M"),
Price = 10,
PriceType = BookingPriceType.FixedPrice,
Reminders = new List<BookingReminder>()
{
new BookingReminder
{
Message = "This service is tomorrow",
Offset = new Duration("P1D"),
Recipients = BookingReminderRecipients.AllAttendees,
AdditionalData = new Dictionary<string, object>()
{
{"recipients@odata.type", "#microsoft.graph.bookingReminderRecipients"}
}
},
new BookingReminder
{
Message = "Please be available to enjoy your lunch service.",
Offset = new Duration("PT1H"),
Recipients = BookingReminderRecipients.Customer,
AdditionalData = new Dictionary<string, object>()
{
{"recipients@odata.type", "#microsoft.graph.bookingReminderRecipients"}
}
},
new BookingReminder
{
Message = "Please check traffic for next cater.",
Offset = new Duration("PT2H"),
Recipients = BookingReminderRecipients.Staff,
AdditionalData = new Dictionary<string, object>()
{
{"recipients@odata.type", "#microsoft.graph.bookingReminderRecipients"}
}
}
},
ServiceId = "57da6774-a087-4d69-b0e6-6fb82c339976",
ServiceLocation = new Location
{
Address = new 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
{
DateTime = "2018-05-01T12:00:00+00:00",
TimeZone = "UTC"
},
MaximumAttendeesCount = 5,
FilledAttendeesCount = 1,
Customers = new List<BookingCustomerInformationBase>()
{
new BookingCustomerInformation
{
CustomerId = "7ed53fa5-9ef2-4f2f-975b-27447440bc09",
Name = "Jordan Miller",
EmailAddress = "jordanm@contoso.com",
Phone = "213-555-0199",
Notes = null,
Location = new Location
{
DisplayName = "Customer",
LocationEmailAddress = null,
LocationUri = "",
LocationType = null,
UniqueId = null,
UniqueIdType = null,
Address = new 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)"}
}
};
await graphClient.BookingBusinesses["{bookingBusiness-id}"].Appointments
.Request()
.AddAsync(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);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/bookingBusinesses/Contosolunchdelivery@contoso.onmicrosoft.com/appointments"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphBookingAppointment *bookingAppointment = [[MSGraphBookingAppointment alloc] init];
[bookingAppointment setCustomerEmailAddress:@"jordanm@contoso.com"];
MSGraphLocation *customerLocation = [[MSGraphLocation alloc] init];
MSGraphPhysicalAddress *address = [[MSGraphPhysicalAddress alloc] init];
[address setCity:@"Buffalo"];
[address setCountryOrRegion:@"USA"];
[address setPostalCode:@"98052"];
[address setPostOfficeBox: null];
[address setState:@"NY"];
[address setStreet:@"123 First Avenue"];
[address setType: null];
[customerLocation setAddress:address];
[customerLocation setCoordinates: null];
[customerLocation setDisplayName:@"Customer"];
[customerLocation setLocationEmailAddress: null];
[customerLocation setLocationType: null];
[customerLocation setLocationUri: null];
[customerLocation setUniqueId: null];
[customerLocation setUniqueIdType: null];
[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];
MSGraphDateTimeTimeZone *end = [[MSGraphDateTimeTimeZone alloc] init];
[end setDateTime: "2018-05-01T12:30:00+00:00"];
[end setTimeZone:@"UTC"];
[bookingAppointment setEnd:end];
[bookingAppointment setInvoiceAmount: 10.0];
MSGraphDateTimeTimeZone *invoiceDate = [[MSGraphDateTimeTimeZone alloc] init];
[invoiceDate setDateTime: "2018-05-01T12:30:00+00:00"];
[invoiceDate setTimeZone:@"UTC"];
[bookingAppointment setInvoiceDate:invoiceDate];
[bookingAppointment setInvoiceId:@"1001"];
[bookingAppointment setInvoiceStatus: [MSGraphBookingInvoiceStatus open]];
[bookingAppointment setInvoiceUrl:@"theInvoiceUrl"];
[bookingAppointment setIsLocationOnline: true];
[bookingAppointment setOptOutOfCustomerEmail: false];
[bookingAppointment setPostBuffer:@"PT10M"];
[bookingAppointment setPreBuffer:@"PT5M"];
[bookingAppointment setPrice: 10.0];
[bookingAppointment setPriceType: [MSGraphBookingPriceType fixedPrice]];
NSMutableArray *remindersList = [[NSMutableArray alloc] init];
MSGraphBookingReminder *reminders = [[MSGraphBookingReminder alloc] init];
[reminders setMessage:@"This service is tomorrow"];
[reminders setOffset:@"P1D"];
[reminders setRecipients: [MSGraphBookingReminderRecipients allAttendees]];
[remindersList addObject: reminders];
MSGraphBookingReminder *reminders = [[MSGraphBookingReminder alloc] init];
[reminders setMessage:@"Please be available to enjoy your lunch service."];
[reminders setOffset:@"PT1H"];
[reminders setRecipients: [MSGraphBookingReminderRecipients customer]];
[remindersList addObject: reminders];
MSGraphBookingReminder *reminders = [[MSGraphBookingReminder alloc] init];
[reminders setMessage:@"Please check traffic for next cater."];
[reminders setOffset:@"PT2H"];
[reminders setRecipients: [MSGraphBookingReminderRecipients staff]];
[remindersList addObject: reminders];
[bookingAppointment setReminders:remindersList];
[bookingAppointment setServiceId:@"57da6774-a087-4d69-b0e6-6fb82c339976"];
MSGraphLocation *serviceLocation = [[MSGraphLocation alloc] init];
MSGraphPhysicalAddress *address = [[MSGraphPhysicalAddress alloc] init];
[address setCity:@"Buffalo"];
[address setCountryOrRegion:@"USA"];
[address setPostalCode:@"98052"];
[address setPostOfficeBox: null];
[address setState:@"NY"];
[address setStreet:@"123 First Avenue"];
[address setType: null];
[serviceLocation setAddress:address];
[serviceLocation setCoordinates: null];
[serviceLocation setDisplayName:@"Customer location"];
[serviceLocation setLocationEmailAddress: null];
[serviceLocation setLocationType: null];
[serviceLocation setLocationUri: null];
[serviceLocation setUniqueId: null];
[serviceLocation setUniqueIdType: null];
[bookingAppointment setServiceLocation:serviceLocation];
[bookingAppointment setServiceName:@"Catered bento"];
[bookingAppointment setServiceNotes:@"Customer requires punctual service."];
MSGraphDateTimeTimeZone *start = [[MSGraphDateTimeTimeZone alloc] init];
[start setDateTime: "2018-05-01T12:00:00+00:00"];
[start setTimeZone:@"UTC"];
[bookingAppointment setStart:start];
[bookingAppointment setMaximumAttendeesCount: 5];
[bookingAppointment setFilledAttendeesCount: 1];
NSMutableArray *customersList = [[NSMutableArray alloc] init];
MSGraphBookingCustomerInformationBase *customers = [[MSGraphBookingCustomerInformationBase alloc] init];
[customers setCustomerId:@"7ed53fa5-9ef2-4f2f-975b-27447440bc09"];
[customers setName:@"Jordan Miller"];
[customers setEmailAddress:@"jordanm@contoso.com"];
[customers setPhone:@"213-555-0199"];
[customers setNotes: null];
MSGraphLocation *location = [[MSGraphLocation alloc] init];
[location setDisplayName:@"Customer"];
[location setLocationEmailAddress: null];
[location setLocationUri:@""];
[location setLocationType: null];
[location setUniqueId: null];
[location setUniqueIdType: null];
MSGraphPhysicalAddress *address = [[MSGraphPhysicalAddress alloc] init];
[address setType: [MSGraphPhysicalAddressType home]];
[address setPostOfficeBox:@""];
[address setStreet:@""];
[address setCity:@""];
[address setState:@""];
[address setCountryOrRegion:@""];
[address setPostalCode:@""];
[location setAddress:address];
MSGraphOutlookGeoCoordinates *coordinates = [[MSGraphOutlookGeoCoordinates alloc] init];
[coordinates setAltitude: null];
[coordinates setLatitude: null];
[coordinates setLongitude: null];
[coordinates setAccuracy: null];
[coordinates setAltitudeAccuracy: null];
[location setCoordinates:coordinates];
[customers setLocation:location];
[customers setTimeZone:@"America/Chicago"];
NSMutableArray *customQuestionAnswersList = [[NSMutableArray alloc] init];
MSGraphBookingQuestionAnswer *customQuestionAnswers = [[MSGraphBookingQuestionAnswer alloc] init];
[customQuestionAnswers setQuestionId:@"3bc6fde0-4ad3-445d-ab17-0fc15dba0774"];
[customQuestionAnswers setQuestion:@"What is your age"];
[customQuestionAnswers setAnswerInputType: [MSGraphAnswerInputType text]];
NSMutableArray *answerOptionsList = [[NSMutableArray alloc] init];
[customQuestionAnswers setAnswerOptions:answerOptionsList];
[customQuestionAnswers setIsRequired: true];
[customQuestionAnswers setAnswer:@"25"];
NSMutableArray *selectedOptionsList = [[NSMutableArray alloc] init];
[customQuestionAnswers setSelectedOptions:selectedOptionsList];
[customQuestionAnswersList addObject: customQuestionAnswers];
[customers setCustomQuestionAnswers:customQuestionAnswersList];
[customersList addObject: customers];
[bookingAppointment setCustomers:customersList];
NSError *error;
NSData *bookingAppointmentData = [bookingAppointment getSerializedDataWithError:&error];
[urlRequest setHTTPBody:bookingAppointmentData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
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);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewBookingAppointment()
customerEmailAddress := "jordanm@contoso.com"
requestBody.SetCustomerEmailAddress(&customerEmailAddress)
customerLocation := msgraphsdk.NewLocation()
requestBody.SetCustomerLocation(customerLocation)
address := msgraphsdk.NewPhysicalAddress()
customerLocation.SetAddress(address)
city := "Buffalo"
address.SetCity(&city)
countryOrRegion := "USA"
address.SetCountryOrRegion(&countryOrRegion)
postalCode := "98052"
address.SetPostalCode(&postalCode)
address.SetPostOfficeBox(nil)
state := "NY"
address.SetState(&state)
street := "123 First Avenue"
address.SetStreet(&street)
address.SetType(nil)
address.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.physicalAddress",
"type@odata.type": "#microsoft.graph.physicalAddressType",
}
customerLocation.SetCoordinates(nil)
displayName := "Customer"
customerLocation.SetDisplayName(&displayName)
customerLocation.SetLocationEmailAddress(nil)
customerLocation.SetLocationType(nil)
customerLocation.SetLocationUri(nil)
customerLocation.SetUniqueId(nil)
customerLocation.SetUniqueIdType(nil)
customerLocation.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.location",
"locationType@odata.type": "#microsoft.graph.locationType",
"uniqueIdType@odata.type": "#microsoft.graph.locationUniqueIdType",
}
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 := msgraphsdk.NewDateTimeTimeZone()
requestBody.SetEnd(end)
dateTime := "2018-05-01T12:30:00.0000000+00:00"
end.SetDateTime(&dateTime)
timeZone := "UTC"
end.SetTimeZone(&timeZone)
end.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.dateTimeTimeZone",
}
invoiceAmount := float64(10)
requestBody.SetInvoiceAmount(&invoiceAmount)
invoiceDate := msgraphsdk.NewDateTimeTimeZone()
requestBody.SetInvoiceDate(invoiceDate)
dateTime := "2018-05-01T12:30:00.0000000+00:00"
invoiceDate.SetDateTime(&dateTime)
timeZone := "UTC"
invoiceDate.SetTimeZone(&timeZone)
invoiceDate.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.dateTimeTimeZone",
}
invoiceId := "1001"
requestBody.SetInvoiceId(&invoiceId)
invoiceStatus := "open"
requestBody.SetInvoiceStatus(&invoiceStatus)
invoiceUrl := "theInvoiceUrl"
requestBody.SetInvoiceUrl(&invoiceUrl)
isLocationOnline := true
requestBody.SetIsLocationOnline(&isLocationOnline)
optOutOfCustomerEmail := false
requestBody.SetOptOutOfCustomerEmail(&optOutOfCustomerEmail)
requestBody.SetAnonymousJoinWebUrl(nil)
postBuffer := "PT10M"
requestBody.SetPostBuffer(&postBuffer)
preBuffer := "PT5M"
requestBody.SetPreBuffer(&preBuffer)
price := float64(10)
requestBody.SetPrice(&price)
priceType := "fixedPrice"
requestBody.SetPriceType(&priceType)
requestBody.SetReminders( []BookingReminder {
msgraphsdk.NewBookingReminder(),
message := "This service is tomorrow"
SetMessage(&message)
offset := "P1D"
SetOffset(&offset)
recipients := "allAttendees"
SetRecipients(&recipients)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingReminder",
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",
}
msgraphsdk.NewBookingReminder(),
message := "Please be available to enjoy your lunch service."
SetMessage(&message)
offset := "PT1H"
SetOffset(&offset)
recipients := "customer"
SetRecipients(&recipients)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingReminder",
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",
}
msgraphsdk.NewBookingReminder(),
message := "Please check traffic for next cater."
SetMessage(&message)
offset := "PT2H"
SetOffset(&offset)
recipients := "staff"
SetRecipients(&recipients)
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingReminder",
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",
}
}
serviceId := "57da6774-a087-4d69-b0e6-6fb82c339976"
requestBody.SetServiceId(&serviceId)
serviceLocation := msgraphsdk.NewLocation()
requestBody.SetServiceLocation(serviceLocation)
address := msgraphsdk.NewPhysicalAddress()
serviceLocation.SetAddress(address)
city := "Buffalo"
address.SetCity(&city)
countryOrRegion := "USA"
address.SetCountryOrRegion(&countryOrRegion)
postalCode := "98052"
address.SetPostalCode(&postalCode)
address.SetPostOfficeBox(nil)
state := "NY"
address.SetState(&state)
street := "123 First Avenue"
address.SetStreet(&street)
address.SetType(nil)
address.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.physicalAddress",
"type@odata.type": "#microsoft.graph.physicalAddressType",
}
serviceLocation.SetCoordinates(nil)
displayName := "Customer location"
serviceLocation.SetDisplayName(&displayName)
serviceLocation.SetLocationEmailAddress(nil)
serviceLocation.SetLocationType(nil)
serviceLocation.SetLocationUri(nil)
serviceLocation.SetUniqueId(nil)
serviceLocation.SetUniqueIdType(nil)
serviceLocation.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.location",
"locationType@odata.type": "#microsoft.graph.locationType",
"uniqueIdType@odata.type": "#microsoft.graph.locationUniqueIdType",
}
serviceName := "Catered bento"
requestBody.SetServiceName(&serviceName)
serviceNotes := "Customer requires punctual service."
requestBody.SetServiceNotes(&serviceNotes)
start := msgraphsdk.NewDateTimeTimeZone()
requestBody.SetStart(start)
dateTime := "2018-05-01T12:00:00.0000000+00:00"
start.SetDateTime(&dateTime)
timeZone := "UTC"
start.SetTimeZone(&timeZone)
start.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.dateTimeTimeZone",
}
maximumAttendeesCount := int32(5)
requestBody.SetMaximumAttendeesCount(&maximumAttendeesCount)
filledAttendeesCount := int32(1)
requestBody.SetFilledAttendeesCount(&filledAttendeesCount)
requestBody.SetCustomers( []BookingCustomerInformationBase {
msgraphsdk.NewBookingCustomerInformationBase(),
SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingCustomerInformation",
"customerId": "7ed53fa5-9ef2-4f2f-975b-27447440bc09",
"name": "Jordan Miller",
"emailAddress": "jordanm@contoso.com",
"phone": "213-555-0199",
"notes": nil,
"timeZone": "America/Chicago",
"customQuestionAnswers": []Object {
}
}
}
requestBody.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingAppointment",
"invoiceStatus@odata.type": "#microsoft.graph.bookingInvoiceStatus",
"priceType@odata.type": "#microsoft.graph.bookingPriceType",
"reminders@odata.type": "#Collection(microsoft.graph.bookingReminder)",
}
bookingBusinessId := "bookingBusiness-id"
result, err := graphClient.BookingBusinessesById(&bookingBusinessId).Appointments().Post(requestBody)
Import-Module Microsoft.Graph.Bookings
$params = @{
"@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
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
"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 = ""
}
}
TimeZone = "America/Chicago"
CustomQuestionAnswers = @(
)
}
)
}
New-MgBookingBusinessAppointment -BookingBusinessId $bookingBusinessId -BodyParameter $params
Nachfolgend sehen Sie ein Beispiel der Antwort.