消息:答复message: reply

命名空间:microsoft.graphNamespace: microsoft.graph

全部在一个 reply 调用中回复邮件的发件人、添加注释或修改任意可更新的属性。然后邮件保存在已发送邮件文件夹中。Reply to the sender of a message, add a comment or modify any updateable properties all in one reply call. The message is then saved in the Sent Items folder.

或者,您可以先创建草稿答复邮件以包含注释或更新任何邮件属性,然后发送回复。Alternatively, you can first create a draft reply message to include a comment or update any message properties, and then send the reply.

注意Note

  • 您可以指定message参数的注释或body属性。You can specify either a comment or the body property of the message parameter. 同时指定这两个将返回 HTTP 400 错误的请求错误。Specifying both will return an HTTP 400 Bad Request error.
  • 如果在原始邮件中指定了replyTo属性(根据 Internet 邮件格式(RFC 2822)),则应将答复发送给replyTo中的收件人,而不是发人属性中的收件人。If the replyTo property is specified in the original message, per Internet Message Format (RFC 2822), you should send the reply to the recipients in replyTo and not the recipient in the from property.

权限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) Mail.SendMail.Send
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) Mail.SendMail.Send
应用程序Application Mail.SendMail.Send

HTTP 请求HTTP request

POST /me/messages/{id}/reply
POST /users/{id | userPrincipalName}/messages/{id}/reply
POST /me/mailFolders/{id}/messages/{id}/reply
POST /users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}/reply

请求标头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 要包含的注释。可以为空字符串。A comment to include. Can be an empty string.
messagemessage 邮件message 答复邮件中要更新的任何可写属性。Any writeable properties to update in the reply message.

响应Response

如果成功,此方法返回 202 Accepted 响应代码。它不在响应正文中返回任何内容。If successful, this method returns 202 Accepted response code. It does not return anything in the response body.

示例Example

下面的示例包含注释并将收件人添加到回复邮件中。The following example includes a comment and adds a recipient to the reply message.

请求Request

下面是一个请求示例。Here is an example of the request.

POST https://graph.microsoft.com/v1.0/me/messages/AAMkADA1MTAAAAqldOAAA=/reply
Content-Type: application/json

{
  "message":{  
    "toRecipients":[
      {
        "emailAddress": {
          "address":"samanthab@contoso.onmicrosoft.com",
          "name":"Samantha Booth"
        }
      },
      {
        "emailAddress":{
          "address":"randiw@contoso.onmicrosoft.com",
          "name":"Randi Welch"
        }
      }
     ]
  },
  "comment": "Samantha, Randi, would you name the group please?" 
}
响应Response

下面是一个响应示例。Here is an example of the response.

HTTP/1.1 202 Accepted