|
| 1 | +--- |
| 2 | +title: "mailFolder: importMime" |
| 3 | +description: "Create a non-draft message in a mailFolder directly from MIME content, without submitting it to transport." |
| 4 | +author: "Yesaket" |
| 5 | +ms.localizationpriority: medium |
| 6 | +ms.subservice: "outlook" |
| 7 | +doc_type: apiPageType |
| 8 | +ms.date: 09/23/2026 |
| 9 | +--- |
| 10 | + |
| 11 | +# mailFolder: importMime |
| 12 | + |
| 13 | +Namespace: microsoft.graph |
| 14 | + |
| 15 | +[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)] |
| 16 | + |
| 17 | +Create a non-draft [message](../resources/message.md) in a [mailFolder](../resources/mailfolder.md) directly from MIME content, without submitting it to transport. |
| 18 | + |
| 19 | +Unlike [creating a message](mailfolder-post-messages.md), which always creates a draft, this action creates the message in a final, non-draft state. The message appears in the destination folder as if it was delivered; however, it doesn't go through transport, isn't stamped as sent, and never appears in the *Sent Items* folder. The action preserves the full MIME content, including internet message headers, body parts, and attachments. |
| 20 | + |
| 21 | + |
| 22 | +## Permissions |
| 23 | + |
| 24 | +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](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference). |
| 25 | + |
| 26 | +<!-- { "blockType": "permissions", "name": "mailfolder_importmime" } --> |
| 27 | +[!INCLUDE [permissions-table](../includes/permissions/mailfolder-importmime-permissions.md)] |
| 28 | + |
| 29 | +## HTTP request |
| 30 | + |
| 31 | +<!-- { |
| 32 | + "blockType": "ignored" |
| 33 | +} |
| 34 | +--> |
| 35 | +``` http |
| 36 | +POST /me/mailFolders/{mailFolderId}/importMime |
| 37 | +POST /users/{usersId}/mailFolders/{mailFolderId}/importMime |
| 38 | +``` |
| 39 | + |
| 40 | +>**Note:** The `{mailFolderId}` can be a folder ID or a well-known folder name such as `inbox`. |
| 41 | +
|
| 42 | +## Request headers |
| 43 | + |
| 44 | +|Name|Description| |
| 45 | +|:---|:---| |
| 46 | +|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).| |
| 47 | +|Content-Type|`text/plain`. Required.| |
| 48 | + |
| 49 | +## Request body |
| 50 | + |
| 51 | +In the request body, supply the MIME content of the message. Provide the applicable [Internet message headers](https://tools.ietf.org/html/rfc2076) and the [MIME content](https://tools.ietf.org/html/rfc2045), all Base64-encoded. |
| 52 | + |
| 53 | +The entire request body is the Base64-encoded MIME content, with no JSON envelope or parameters. This API doesn't support editing or updating MIME properties individually. |
| 54 | + |
| 55 | +## Response |
| 56 | + |
| 57 | +If successful, this action returns a `201 Created` response code and a [message](../resources/message.md) object in the response body. The returned message has **isDraft** set to `false`. |
| 58 | + |
| 59 | +If the request body includes malformed MIME content, this action returns a `400 Bad Request` response code and the following error message: `Invalid base64 string for MIME content.` |
| 60 | + |
| 61 | +## Examples |
| 62 | + |
| 63 | +### Request |
| 64 | + |
| 65 | +The following example shows a request. The request body is the Base64-encoded MIME content, shortened for readability. |
| 66 | + |
| 67 | +<!-- { |
| 68 | + "blockType": "request", |
| 69 | + "name": "mailfolder_importmime_beta" |
| 70 | +} |
| 71 | +--> |
| 72 | +``` http |
| 73 | +POST https://graph.microsoft.com/beta/me/mailFolders/inbox/importMime |
| 74 | +Content-type: text/plain |
| 75 | +
|
| 76 | +RnJvbTogY29udG9zby1hbGVydHNAY29udG9zby5jb20NClRvOiB0ZXN0aW5nQGNvbnRvc28uY29t |
| 77 | +DQpTdWJqZWN0OiBRdWFydGVybHkgcmVwb3J0DQpEYXRlOiBUaHUsIDI1IEp1biAyMDI2IDEwOjAw |
| 78 | +OjAwIC0wNzAwDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9InV0Zi04Ig0KDQpC |
| 79 | +b2R5IG9mIHRoZSBpbXBvcnRlZCBtZXNzYWdlLg== |
| 80 | +``` |
| 81 | + |
| 82 | +### Response |
| 83 | + |
| 84 | +The following example shows the response. |
| 85 | + |
| 86 | +>**Note:** The response object shown here might be shortened for readability. |
| 87 | +
|
| 88 | +<!-- { |
| 89 | + "blockType": "response", |
| 90 | + "truncated": true, |
| 91 | + "@odata.type": "microsoft.graph.message" |
| 92 | +} |
| 93 | +--> |
| 94 | +``` http |
| 95 | +HTTP/1.1 201 Created |
| 96 | +Content-type: application/json |
| 97 | +
|
| 98 | +{ |
| 99 | + "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('02d1914d-7abd-4621-a407-57b8bdeb1ada')/messages/$entity", |
| 100 | + "id": "AAMkADE5MWM0YmM5LThjOWUtNGFhZi1hOTBhLWNmZDBiZDhhNTljMABGAAAA", |
| 101 | + "createdDateTime": "2026-09-17T21:30:19Z", |
| 102 | + "lastModifiedDateTime": "2026-09-17T21:30:20Z", |
| 103 | + "receivedDateTime": "2026-09-17T21:30:20Z", |
| 104 | + "sentDateTime": "2026-07-24T20:03:00Z", |
| 105 | + "hasAttachments": false, |
| 106 | + "subject": "Quarterly report", |
| 107 | + "isRead": false, |
| 108 | + "isDraft": false, |
| 109 | + "parentFolderId": "AAMkADE5MWM0YmM5LThjOWUtNGFhZi1hOTBhLWNmZDBiZDhhNTljMAAuAAAA" |
| 110 | +} |
| 111 | +``` |
0 commit comments