event: declineevent: decline
命名空间:microsoft.graphNamespace: microsoft.graph
拒绝对用户日历中指定事件的邀请。Decline invitation to the specified event in a user calendar.
如果事件允许建议的新时间,在谢绝事件时,被邀请者可以通过包含 proposedNewTime 参数来选择建议替代时间。If the event allows proposals for new times, on declining the event, an invitee can choose to suggest an alternative time by including the proposedNewTime parameter. 有关如何建议时间以及如何接收和接受新时间建议的详细信息,请参阅 建议新会议时间。For more information on how to propose a time, and how to receive and accept a new time proposal, see Propose new meeting times.
权限Permissions
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
权限类型Permission type | 权限(从最低特权到最高特权)Permissions (from least to most privileged) |
---|---|
委派(工作或学校帐户)Delegated (work or school account) | Calendars.ReadWriteCalendars.ReadWrite |
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) | Calendars.ReadWriteCalendars.ReadWrite |
应用程序Application | Calendars.ReadWriteCalendars.ReadWrite |
HTTP 请求HTTP request
POST /me/events/{id}/decline
POST /users/{id | userPrincipalName}/events/{id}/decline
POST /me/calendar/events/{id}/decline
POST /users/{id | userPrincipalName}/calendar/events/{id}/decline
POST /me/calendars/{id}/events/{id}/decline
POST /users/{id | userPrincipalName}/calendars/{id}/events/{id}/decline
POST /me/calendargroup/calendars/{id}/events/{id}/decline
POST /users/{id | userPrincipalName}/calendargroup/calendars/{id}/events/{id}/decline
POST /me/calendargroups/{id}/calendars/{id}/events/{id}/decline
POST /users/{id | userPrincipalName}/calendargroups/{id}/calendars/{id}/events/{id}/decline
请求标头Request headers
名称Name | 类型Type | 说明Description |
---|---|---|
AuthorizationAuthorization | stringstring | Bearer {token}。必需。Bearer {token}. Required. |
Content-TypeContent-Type | stringstring | 实体正文中的数据性质。必需。Nature of the data in the body of an entity. Required. |
请求正文Request body
在请求正文中,提供具有以下参数的 JSON 对象。In the request body, provide a JSON object with the following parameters.
参数Parameter | 类型Type | 说明Description |
---|---|---|
注释comment | StringString | 响应中包含的文本。可选。Text included in the response. Optional. |
proposedNewTimeproposedNewTime | timeSlottimeSlot | 会议请求开始和结束时由被邀请者建议的备用日期/时间。An alternate date/time proposed by an invitee for a meeting request to start and end. 仅对允许新时间建议的事件有效。Valid only for events that allow new time proposals. 设置此参数需要将 sendResponse 设置为 true 。Setting this parameter requires setting sendResponse to true . 可选。Optional. |
sendResponsesendResponse | BooleanBoolean | 如果将响应发送给组织者,则值为 true ;否则为 false 。可选。默认值为 true 。true if a response is to be sent to the organizer; otherwise, false . Optional. Default is true . |
响应Response
如果成功,此方法返回 202 Accepted
响应代码。它不在响应正文中返回任何内容。If successful, this method returns 202 Accepted
response code. It does not return anything in the response body.
如果出现以下一种或两种情况,此操作将返回 HTTP 400:This action returns HTTP 400 if one or both of the following occur:
- 包含proposedNewTime参数,但事件的allowNewTimeProposals属性为
false
。The proposedNewTime parameter is included but the allowNewTimeProposals property of the event isfalse
. - 包含 proposedNewTime 参数,但 sendResponse 参数设置为
false
。The proposedNewTime parameter is included but the sendResponse parameter is set tofalse
.
示例Example
下面是一个如何调用此 API 的示例。Here is an example of how to call this API.
请求Request
下面是一个请求示例。Here is an example of the request.
POST https://graph.microsoft.com/v1.0/me/events/{id}/decline
Content-type: application/json
{
"comment": "I won't be able to make this week. How about next week?",
"sendResponse": true,
"proposedNewTime": {
"start": {
"dateTime": "2019-12-02T18:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2019-12-02T19:00:00",
"timeZone": "Pacific Standard Time"
}
}
}
响应Response
下面是一个响应示例。Here is an example of the response.
HTTP/1.1 202 Accepted