• 指定参数的 message 注释或 正文 属性。 指定这两者将返回 HTTP 400 错误请求错误。
  • 指定 参数或 toRecipients 参数的 message toRecipients 属性。 同时指定或指定两者均不指定将返回 HTTP 400 错误请求错误。
  • 使用 MIME 格式时:

  • 提供适用的 Internet 邮件头 MIME 内容 ,所有内容在请求正文中都通过 base64 格式进行编码。
  • 向 MIME 内容添加任何附件和 S/MIME 属性。
  • 此方法将邮件保存在 “已发送邮件” 文件夹中。

    或者, 创建草稿以转发邮件 ,并在以后 发送

    调用此 API 需要下列权限之一。 若要了解详细信息,包括如何选择权限的信息,请参阅 权限

    权限(从最低特权到最高特权)
    POST /me/messages/{id}/forward
    POST /users/{id | userPrincipalName}/messages/{id}/forward
    POST /me/mailFolders/{id}/messages/{id}/forward
    POST /users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}/forward
    

    当指定 MIME 格式的正文时,请提供 MIME 内容与适用的 Internet 邮件头(“收件人”、“抄送”、“密件抄送”、“主题”)所有内容在请求正文中编码为 base64 格式。

    如果成功,此方法返回 202 Accepted 响应代码。 它不会在响应正文中返回任何内容。

    如果请求正文包含错误的 MIME 内容,此方法将返回 400 Bad request 和以下错误消息:“无效的 base64 字符串 MIME 内容”。

    示例 1:使用 JSON 格式转发消息

    下面是一个如何调用此 API 的示例。

    下面是一个请求示例。

    JavaScript PowerShell
    POST https://graph.microsoft.com/v1.0/me/messages/{id}/forward
    Content-type: application/json
      "comment": "comment-value",
      "toRecipients": [
          "emailAddress": {
            "name": "name-value",
            "address": "address-value"
    var graphClient = new GraphServiceClient(requestAdapter);
    var requestBody = new Microsoft.Graph.Me.Messages.Item.Forward.ForwardPostRequestBody
    	Comment = "comment-value",
    	ToRecipients = new List<Recipient>
    		new Recipient
    			EmailAddress = new EmailAddress
    				Name = "name-value",
    				Address = "address-value",
    await graphClient.Me.Messages["{message-id}"].Forward.PostAsync(requestBody);
    	  "context"
    	  msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
    	  graphmodels "github.com/microsoftgraph/msgraph-sdk-go/Me/Messages/Item/Forward"
    	  //other-imports
    graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
    requestBody := graphmodels.NewForwardPostRequestBody()
    comment := "comment-value"
    requestBody.SetComment(&comment) 
    recipient := graphmodels.NewRecipient()
    emailAddress := graphmodels.NewEmailAddress()
    name := "name-value"
    emailAddress.SetName(&name) 
    address := "address-value"
    emailAddress.SetAddress(&address) 
    recipient.SetEmailAddress(emailAddress)
    toRecipients := []graphmodels.Recipientable {
    	recipient,
    requestBody.SetToRecipients(toRecipients)
    graphClient.Me().Messages().ByMessageId("message-id").Forward().Post(context.Background(), requestBody, nil)
    GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
    String comment = "comment-value";
    LinkedList<Recipient> toRecipientsList = new LinkedList<Recipient>();
    Recipient toRecipients = new Recipient();
    EmailAddress emailAddress = new EmailAddress();
    emailAddress.name = "name-value";
    emailAddress.address = "address-value";
    toRecipients.emailAddress = emailAddress;
    toRecipientsList.add(toRecipients);
    graphClient.me().messages("{id}")
    	.forward(MessageForwardParameterSet
    		.newBuilder()
    		.withToRecipients(toRecipientsList)
    		.withMessage(null)
    		.withComment(comment)
    		.build())
    	.buildRequest()
    	.post();
    // THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
    $graphServiceClient = new GraphServiceClient($requestAdapter);
    $requestBody = new ForwardPostRequestBody();
    $requestBody->setComment('comment-value');
    $toRecipientsRecipient1 = new Recipient();
    $toRecipientsRecipient1EmailAddress = new EmailAddress();
    $toRecipientsRecipient1EmailAddress->setName('name-value');
    $toRecipientsRecipient1EmailAddress->setAddress('address-value');
    $toRecipientsRecipient1->setEmailAddress($toRecipientsRecipient1EmailAddress);
    $toRecipientsArray []= $toRecipientsRecipient1;
    $requestBody->setToRecipients($toRecipientsArray);
    
    POST https://graph.microsoft.com/v1.0/me/messages/AAMkADA1MTAAAAqldOAAA=/forward
    Content-type: text/plain
    Q29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi9wa2NzNy1taW1lOw0KCW5hbWU9c21pbWUucDdtOw0KCXNtaW1lLXR5cGU9ZW52ZWxvcGVkLWRhdGENCk1pbWUtVmVyc2lvbjogMS4wIChNYWMgT1MgWCBNYWlsIDEzLjAgXCgzNjAxLjAuMTBcKSkNClN1YmplY3Q6IFJlOiBUZXN0aW5nIFMvTUlNRQ0KQ29udGVudC1EaXNwb3Np
    

    下面是一个响应示例。

    HTTP/1.1 202 Accepted
    

    如果请求正文包含错误的 MIME 内容,此方法返回以下错误消息。

    HTTP/1.1 400 Bad Request
    Content-type: application/json
        "error": {
            "code": "ErrorMimeContentInvalidBase64String",
            "message": "Invalid base64 string for MIME content."