调用Microsoft Graph Bookings API创建预约遇UnknownError求助
使用Microsoft Graph API创建Bookings预约时遭遇UnknownError问题
尝试通过Microsoft Graph API调用Bookings的「Booking Business」端点创建预约,官方文档对实现细节说明不够清晰。已完成正确认证流程,但始终无法成功创建预约,且返回的错误信息无有效排查线索。
核心请求示例
POST https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/MyCalendar@MyOrg.com/appointments Content-Type: application/json
{ "@odata.type": "#microsoft.graph.bookingAppointment", "serviceId": "a98309e9-3104-411f-q681-71c7df95a178", "duration": "PT30M", "start_date_time": { "dateTime": "2022-12-22T14:30:00+00:00", "timeZone": "UTC" }, "staffMemberIds": [ "e220feb5-5bc-43c6-922z-a2cd5a545ec2" ], "isLocationOnline": true, "filedAttendeeCount": 1, "reminders@odata.type": "#Collection(microsoft.graph.bookingReminder)", "reminders": [ { "message": "Remember your important appointment today", "offset": "PT120M", "recipients": "allAttendees" } ], "customers": [ { "@odata.type": "#microsoft.graph.bookingCustomerInformation", "name": "Barrington Visitor", "emailAddress": "visitor@visitor-organisation.org" } ] }
错误响应
{ "error":{ "code": "UnknownError", "message": "", "innerError":{ "date": "2022-11-01T15:27:06", "request-id": "72e0b067-6347-4cb9-9257-04db4765908a", "client-request-id": "72e0e061-6347-4cb9-9127-0fdb47a590aa" } } }
已完成的排查动作
- 修复了
customer字段未添加@odata.type的问题(原会触发InvalidModel错误,提示changes: Cannot create an abstract class.) - 已知非UTC时区会导致同类
UnknownError,已将所有时间字段统一为UTC时区 - 在AAD门户查询对应
request-id,仅显示认证成功,无后续错误日志 - 补充了文档示例中的所有字段(包括非必填字段),调整后的请求如下,但仍返回相同错误:
{ "@odata.type": "#microsoft.graph.bookingAppointment", "customerTimeZone": "UTC", "serviceId": "a98309e9-3104-411f-q681-71c7df95a178", "serviceName": "Appointment Service", "serviceNotes": "", "smsNotificationsEnabled": false, "serviceLocation": { "@odata.type": "#microsoft.graph.location", "address": null, "coordinates": null, "displayName": "Online meeting", "locationEmailAddress": null, "locationType@odata.type": "#microsoft.graph.locationType", "locationType": null, "locationUri": null, "uniqueId": null, "uniqueIdType@odata.type": "#microsoft.graph.locationUniqueIdType", "uniqueIdType": null }, "startDateTime": { "@odata.type": "#microsoft.graph.dateTimeTimeZone", "dateTime": "2022-12-22T14:30:00+00:00", "timeZone": "UTC" }, "endDateTime": { "@odata.type": "#microsoft.graph.dateTimeTimeZone", "dateTime": "2022-12-22T15:00:00+00:00", "timeZone": "UTC" }, "duration": "PT30M", "postBuffer": "PT5M", "preBuffer": "PT1M", "price": 0, "priceType": "free", "priceType@odata.type": "#microsoft.graph.bookingPriceType", "staffMemberIds": [ "e220feb5-5bc-43c6-922z-a2cd5a545ec2" ], "isLocationOnline": true, "maximumAttendeesCount": 1, "filledAttendeesCount": 1, "reminders@odata.type": "#Collection(microsoft.graph.bookingReminder)", "reminders": [ { "@odata.type": "microsoft.graph.bookingReminder", "message": "Remember your important appointment today", "offset": "PT120M", "recipients@odata.type": "#microsoft.graph.bookingReminderRecipients", "recipients": "allAttendees" } ], "customers@odata.type": "#Collection(microsoft.graph.bookingCustomerInformation)", "customers": [ { "@odata.type": "#microsoft.graph.bookingCustomerInformation", "name": "Barrington Visitor", "emailAddress": "visitor@visitor-organisation.org", "phone": null, "notes": null, "location": null, "timeZone": "UTC", "customQuestionAnswers": [] } ] }
求助问题
是否有针对此UnknownError的有效排查方法或解决方案?请求中是否存在未被发现的格式或字段错误?
内容的提问来源于stack exchange,提问作者glenatron
相关产品推荐
相关产品推荐

