更新 bookingAppointment
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新指定 bookingBusiness 中 bookingAppointment 对象的属性。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
BookingsAppointment.ReadWrite.All,Bookings。ReadWrite.All,Bookings。Manage.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| Application |
BookingsAppointment.ReadWrite.All,Bookings。Read.All |
备注
如果使用应用程序权限创建自定义应用,则必须遵循 业务规则验证。
HTTP 请求
PATCH /bookingBusinesses/{id}/appointments/{id}
| 名称 |
说明 |
| Authorization |
持有者 {code}。必需。 |
请求正文
在请求正文中,仅 提供应更新的属性的值。未包含在请求正文中的现有属性将保留其以前的值或根据对其他属性值的更改重新计算。
下表指定可以更新的属性。
| 属性 |
类型 |
说明 |
| customerEmailAddress |
String |
预订约会的 bookingCustomer 的 SMTP 地址。 |
| customerId |
String |
此约会的 bookingCustomer 的 ID。 如果在创建约会时未指定 ID,则会创建新的 bookingCustomer 对象。 设置后,应考虑 customerId 不可变。 |
| customerLocation |
location |
表示预订约会的 bookingCustomer 的位置信息。 |
| customerName |
String |
客户的名称。 |
| customerNotes |
String |
与此约会关联的客户的说明。 仅当按其 ID 读取此 bookingAppointment 时,才可以获取该值。 只有在最初与新客户创建约会时,才能设置此属性。 之后,该值将从 customerId 代表的客户计算。 |
| customerPhone |
String |
客户的电话号码。 |
| 客户 |
bookingCustomerInformation 集合 |
它列出了约会的客户属性。 约会将包含客户信息列表,每个单位将指示属于该约会的客户的属性。 可选。 |
| customerTimeZone |
String |
客户的时区。 有关可能值的列表,请参阅 dateTimeTimeZone。 |
| duration |
期限 |
约会的长度,以 ISO8601 格式表示。 |
| end |
dateTimeTimeZone |
约会结束的日期、时间和时区。 |
| invoiceAmount |
双精度 |
发票上的计费金额。 |
| invoiceDate |
dateTimeTimeZone |
此约会的发票的日期、时间和时区。 |
| invoiceId |
String |
发票的 ID。 |
| invoiceStatus |
string |
发票的状态。 可取值为:draft、reviewing、open、canceled、paid、corrective。 |
| invoiceUrl |
String |
Microsoft Bookings中的发票 URL。 |
| filledAttendeesCount |
Int32 |
约会中的当前客户数。 必需。 |
| isLocationOnline |
Boolean |
True 表示约会将联机进行。 默认值为 false。 |
| maximumAttendeesCount |
Int32 |
约会中允许的最大客户数。 必需。 |
| optOutOfCustomerEmail |
Boolean |
True 表示此约会的 bookingCustomer 不希望收到此约会的确认。 |
| postBuffer |
期限 |
例如,约会结束后要保留的时间,用于清理。 该值以 ISO8601 格式表示。 |
| preBuffer |
期限 |
例如,在约会开始之前,为准备而保留的时间量。 该值以 ISO8601 格式表示。 |
| 价格 |
双精度 |
指定 bookingService 的约会的常规价格。 |
| priceType |
bookingPriceType |
一个设置,用于为服务的定价结构提供灵活性。 可取值为:undefined、fixedPrice、startingAt、hourly、free、priceVaries、callUs、notSet、unknownFutureValue。 |
| 提醒 |
bookingReminder 集合 |
为此约会发送的客户提醒的集合。 仅当按其 ID 读取此 bookingAppointment 时,此属性的值才可用。 |
| selfServiceAppointmentId |
String |
如果约会是由客户直接在计划页上创建的,而不是由代表客户的工作人员创建的,则为约会提供额外的跟踪 ID。 |
| 服务 Id |
String |
与此约会关联的 bookingService 的 ID。 |
| serviceLocation |
location |
服务的传送位置。 |
| serviceName |
String |
与此约会关联的 bookingService 的名称。 创建新约会时,此属性是可选的。 如果未指定,则会从 ServiceId 属性与约会关联的服务中进行计算。 |
| serviceNotes |
String |
bookingStaffMember 中的备注。 仅当按其 ID 读取此 bookingAppointment 时,此属性的值才可用。 |
| smsNotificationsEnabled |
Boolean |
True 表示将向客户发送短信通知以进行约会。 默认值为 false。 |
| staffMemberIds |
String collection |
此约会中计划的每位 bookingStaffMember 的 ID。 |
| start |
dateTimeTimeZone |
约会开始的日期、时间和时区。 |
备注
如果服务中允许的最大客户数 (最大AttedeesCount) 大于 1:
响应
如果成功,此方法返回 204 No Content 响应代码。 它不会在响应正文中返回任何内容。
示例
请求
以下示例将服务日期更改为一天,并更新发票日期。
PATCH https://graph.microsoft.com/beta/bookingBusinesses/Contosolunchdelivery@contoso.onmicrosoft.com/appointments/AAMkADKnAAA=
Content-type: application/json
{
"@odata.type":"#microsoft.graph.bookingAppointment",
"end":{
"@odata.type":"#microsoft.graph.dateTimeTimeZone",
"dateTime":"2018-05-06T12:30:00.0000000+00:00",
"timeZone":"UTC"
},
"invoiceDate":{
"@odata.type":"#microsoft.graph.dateTimeTimeZone",
"dateTime":"2018-05-06T12:30:00.0000000+00:00",
"timeZone":"UTC"
},
"start":{
"@odata.type":"#microsoft.graph.dateTimeTimeZone",
"dateTime":"2018-05-06T12:00:00.0000000+00:00",
"timeZone":"UTC"
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var bookingAppointment = new BookingAppointment
{
End = new DateTimeTimeZone
{
DateTime = "2018-05-06T12:30:00+00:00",
TimeZone = "UTC"
},
InvoiceDate = new DateTimeTimeZone
{
DateTime = "2018-05-06T12:30:00+00:00",
TimeZone = "UTC"
},
Start = new DateTimeTimeZone
{
DateTime = "2018-05-06T12:00:00+00:00",
TimeZone = "UTC"
}
};
await graphClient.BookingBusinesses["{bookingBusiness-id}"].Appointments["{bookingAppointment-id}"]
.Request()
.UpdateAsync(bookingAppointment);
const options = {
authProvider,
};
const client = Client.init(options);
const bookingAppointment = {
'@odata.type':'#microsoft.graph.bookingAppointment',
end: {
'@odata.type':'#microsoft.graph.dateTimeTimeZone',
dateTime: '2018-05-06T12:30:00.0000000+00:00',
timeZone: 'UTC'
},
invoiceDate: {
'@odata.type':'#microsoft.graph.dateTimeTimeZone',
dateTime: '2018-05-06T12:30:00.0000000+00:00',
timeZone: 'UTC'
},
start: {
'@odata.type':'#microsoft.graph.dateTimeTimeZone',
dateTime: '2018-05-06T12:00:00.0000000+00:00',
timeZone: 'UTC'
}
};
await client.api('/bookingBusinesses/Contosolunchdelivery@contoso.onmicrosoft.com/appointments/AAMkADKnAAA=')
.version('beta')
.update(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/AAMkADKnAAA="]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphBookingAppointment *bookingAppointment = [[MSGraphBookingAppointment alloc] init];
MSGraphDateTimeTimeZone *end = [[MSGraphDateTimeTimeZone alloc] init];
[end setDateTime: "2018-05-06T12:30:00+00:00"];
[end setTimeZone:@"UTC"];
[bookingAppointment setEnd:end];
MSGraphDateTimeTimeZone *invoiceDate = [[MSGraphDateTimeTimeZone alloc] init];
[invoiceDate setDateTime: "2018-05-06T12:30:00+00:00"];
[invoiceDate setTimeZone:@"UTC"];
[bookingAppointment setInvoiceDate:invoiceDate];
MSGraphDateTimeTimeZone *start = [[MSGraphDateTimeTimeZone alloc] init];
[start setDateTime: "2018-05-06T12:00:00+00:00"];
[start setTimeZone:@"UTC"];
[bookingAppointment setStart:start];
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();
DateTimeTimeZone end = new DateTimeTimeZone();
end.dateTime = "2018-05-06T12:30:00+00:00";
end.timeZone = "UTC";
bookingAppointment.end = end;
DateTimeTimeZone invoiceDate = new DateTimeTimeZone();
invoiceDate.dateTime = "2018-05-06T12:30:00+00:00";
invoiceDate.timeZone = "UTC";
bookingAppointment.invoiceDate = invoiceDate;
DateTimeTimeZone start = new DateTimeTimeZone();
start.dateTime = "2018-05-06T12:00:00+00:00";
start.timeZone = "UTC";
bookingAppointment.start = start;
graphClient.bookingBusinesses("Contosolunchdelivery@contoso.onmicrosoft.com").appointments("AAMkADKnAAA=")
.buildRequest()
.patch(bookingAppointment);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewBookingAppointment()
end := msgraphsdk.NewDateTimeTimeZone()
requestBody.SetEnd(end)
dateTime := "2018-05-06T12:30:00.0000000+00:00"
end.SetDateTime(&dateTime)
timeZone := "UTC"
end.SetTimeZone(&timeZone)
end.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.dateTimeTimeZone",
}
invoiceDate := msgraphsdk.NewDateTimeTimeZone()
requestBody.SetInvoiceDate(invoiceDate)
dateTime := "2018-05-06T12:30:00.0000000+00:00"
invoiceDate.SetDateTime(&dateTime)
timeZone := "UTC"
invoiceDate.SetTimeZone(&timeZone)
invoiceDate.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.dateTimeTimeZone",
}
start := msgraphsdk.NewDateTimeTimeZone()
requestBody.SetStart(start)
dateTime := "2018-05-06T12:00:00.0000000+00:00"
start.SetDateTime(&dateTime)
timeZone := "UTC"
start.SetTimeZone(&timeZone)
start.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.dateTimeTimeZone",
}
requestBody.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingAppointment",
}
bookingBusinessId := "bookingBusiness-id"
bookingAppointmentId := "bookingAppointment-id"
graphClient.BookingBusinessesById(&bookingBusinessId).AppointmentsById(&bookingAppointmentId).Patch(requestBody)
Import-Module Microsoft.Graph.Bookings
$params = @{
"@odata.type" = "#microsoft.graph.bookingAppointment"
End = @{
"@odata.type" = "#microsoft.graph.dateTimeTimeZone"
DateTime = "2018-05-06T12:30:00.0000000+00:00"
TimeZone = "UTC"
}
InvoiceDate = @{
"@odata.type" = "#microsoft.graph.dateTimeTimeZone"
DateTime = "2018-05-06T12:30:00.0000000+00:00"
TimeZone = "UTC"
}
Start = @{
"@odata.type" = "#microsoft.graph.dateTimeTimeZone"
DateTime = "2018-05-06T12:00:00.0000000+00:00"
TimeZone = "UTC"
}
}
Update-MgBookingBusinessAppointment -BookingBusinessId $bookingBusinessId -BookingAppointmentId $bookingAppointmentId -BodyParameter $params
响应
下面展示了示例响应。
HTTP/1.1 204 No Content