message: createForward
Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Create a draft to forward an existing message, in either JSON or MIME format.
When using JSON format, you can:
- Specify either a comment or the body property of the
message
parameter. Specifying both will return an HTTP 400 Bad Request error. - Specify either the
toRecipients
parameter or the toRecipients property of themessage
parameter. Specifying both or specifying neither will return an HTTP 400 Bad Request error. - Update the draft later to add content to the body or change other message properties.
When using MIME format:
- Provide the applicable Internet message headers and the MIME content, all encoded in base64 format in the request body.
- Add any attachments and S/MIME properties to the MIME content.
Send the draft message in a subsequent operation.
Alternatively, forward a message in a single operation.
This API is available in the following national cloud deployments.
Global service | US Government L4 | US Government L5 (DOD) | China operated by 21Vianet |
---|---|---|---|
✅ | ✅ | ✅ | ✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | Mail.ReadWrite | Not available. |
Delegated (personal Microsoft account) | Mail.ReadWrite | Not available. |
Application | Mail.ReadWrite | Not available. |
HTTP request
POST /me/messages/{id}/createForward
POST /users/{id | userPrincipalName}/messages/{id}/createForward
POST /me/mailFolders/{id}/messages/{id}/createForward
POST /users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}/createForward
Request headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer {token}. Required. Learn more about authentication and authorization. |
Content-Type | string | Nature of the data in the body of an entity. Required. Use application/json for a JSON object and text/plain for MIME content. |
Request body
To send a JSON object, provide the following parameters.
Parameter | Type | Description |
---|---|---|
comment | String | A comment to include. Can be an empty string. |
toRecipients | recipient collection | The list of recipients. |
message | message | Any writeable properties to update in the reply message. |
When specifying the body in MIME format, provide the MIME content with the applicable Internet message headers ("To", "CC", "BCC", "Subject"), all encoded in base64 format in the request body.
Response
If successful, this method returns 201 Created
response code and message object in the response body.
If the request body includes malformed MIME content, this method returns 400 Bad request
and the following error message: "Invalid base64 string for MIME content".
Examples
Example 1: Create a draft message in JSON format to forward an existing message
Here is an example of how to call this API.
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/me/messages/AAMkADA1MTAAAH5JaLAAA=/createForward
Content-Type: application/json
{
"message":{
"isDeliveryReceiptRequested": true,
"toRecipients":[
{
"emailAddress": {
"address":"danas@contoso.com",
"name":"Dana Swope"
}
}
]
},
"comment": "Dana, just want to make sure you get this; you'll need this if the project gets approved."
}
Response
The following example shows the response. Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Me/messages/$entity",
"@odata.id": "https://graph.microsoft.com/beta/users('86b6ceaf-57f7-4278-97c4-4da0a97f6cdb@70559e59-b378-49ea-8e53-07a3a3d27f5b')/messages('AAMkADA1MTAAAH5JKqAAA=')",
"@odata.etag": "W/\"CQAAABYAAADX8oL1Wa7jQbcPAHouCzswAAAH5/DQ\"",
"id": "AAMkADA1MTAAAH5JKqAAA=",
"subject": "FW: Let's start a group",
"body": {
"contentType": "HTML",
"content": "<html>\r\n<body>\r\nDana, just want to make sure you get this; you'll need this if the project gets approved.\r\n<b>From:</b> Admin<br>\r\n<b>Sent:</b> Tuesday, March 15, 2016 6:47:54 AM<br>\r\n<b>To:</b> Samantha Booth; Randi Welch<br>\r\n<b>Subject:</b> RE: Let's start a group</body>\r\n</html>\r\n"
},
"sender": {
"emailAddress": {
"name": "Admin",
"address": "admin@contoso.com"
}
},
"from": null,
"toRecipients": [
{
"emailAddress": {
"name": "Dana Swope",
"address": "danas@contoso.com"
}
}
]
}
Example 2: Create a draft message in MIME format to forward an existing message
Request
POST https://graph.microsoft.com/beta/me/messages/AAMkADA1MTAAAH5JaLAAA=/createForward
Content-Type: text/plain
RnJvbTogQWxleCBXaWxiZXIgPEFsZXhXQGNvbnRvc28uY29tPgpUbzogTWVnYW4gQm93ZW4gPE1l
Z2FuQkBjb250b3NvLmNvbT4KU3ViamVjdDogSW50ZXJuYWwgUmVzdW1lIFN1Ym1pc3Npb246IFNh
bGVzIEFzc29jaWF0ZQpUaHJlYWQtVG9waWM6IEludGVybmFsIFJlc3VtZSBTdWJtaXNzaW9uOiBT
YWxlcyBBc3NvY2lhdGUKVGhyZWFkLUluZGV4OiBjb2RlY29kZWNvZGVoZXJlaGVyZWhlcmUKRGF0
ZTogU3VuLCAyOCBGZWIgMjAyMSAwNzoxNTowMCArMDAwMApNZXNzYWdlLUlEOgoJPE1XSFBSMTMw
MU1CMjAwMDAwMDAwRDc2RDlDMjgyMjAwMDA5QUQ5QTlASFdIUFIxMzAxTUIwMDAwLmNvZGVudW0u
cHJvZC5vdXRsb29rLmNvbT4KQ29udGVudC1MYW5ndWFnZTogZW4tVVMKWC1NUy1IYXMtQXR0YWNo
OgpYLU1TLVRORUYtQ29ycmVsYXRvcjoKWC1NUy1FeGNoYW5n
Response
The following example shows the response.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('0aaa0aa0-0000-0a00-a00a-0000009000a0')/messages/$entity",
"@odata.etag": "W/\"AAAAAAAAAAAa00AAAa0aAaAa0a0AAAaAAAAaAa0a\"",
"id": "AAMkADA1MTAAAAqldOAAA=",
"createdDateTime": "2021-04-23T18:13:44Z",
"lastModifiedDateTime": "2021-04-23T18:13:44Z",
"changeKey": "AAAAAAAAAAAA00aaaa000aaA",
"categories": [],
"receivedDateTime": "2021-04-23T18:13:44Z",
"sentDateTime": "2021-02-28T07:15:00Z",
"hasAttachments": false,
"internetMessageId": "<AAAAAAAAAA@AAAAAAA0001AA0000.codcod00.prod.outlook.com>",
"subject": "Internal Resume Submission: Sales Associate",
"bodyPreview": "Hi, Megan.I have an interest in the Sales Associate position. Please consider my resume, which you can access here...",
"importance": "normal",
"parentFolderId": "LKJDSKJHkjhfakKJHFKWKKJHKJdhkjHDK==",
"conversationId": "SDSFSmFSDGI5LWZhYjc4fsdfsd=",
"conversationIndex": "Adfsdfsdfsdfw==",
"isDeliveryReceiptRequested": null,
"isReadReceiptRequested": false,
"isRead": true,
"isDraft": true,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkAGNhOWAvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"body": {
"contentType": "text",
"content": "Hi, Megan.I have an interest in the Sales Associate position. Please consider my resume, which you can access here... Regards,Alex"
},
"sender": {
"emailAddress": {
"name": "Alex Wilber",
"address": "AlexW@contoso.com"
}
},
"from": {
"emailAddress": {
"name": "Alex Wilber",
"address": "AlexW@contoso.com"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Megan Bowen",
"address": "MeganB@contoso.com"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"flag": {
"flagStatus": "notFlagged"
}
}
If the request body includes malformed MIME content, this method returns the following error message.
HTTP/1.1 400 Bad Request
Content-type: application/json
{
"error": {
"code": "ErrorMimeContentInvalidBase64String",
"message": "Invalid base64 string for MIME content."
}
}