Skip to content

Commit 6b14794

Browse files
YesaketYesaketCopilotJarbasHorst
authored
Add mailFolder: importMime (beta) (#29633)
* Add mailFolder: importMime (beta) Documents the importMime action on mailFolder, which creates a non-draft message directly from base64-encoded MIME content without submitting it to transport. - New API page: api-reference/beta/api/mailfolder-importmime.md - New permissions include for mailfolder-importmime - Adds Import MIME to the mailFolder resource methods table - Adds the changelog entry to changelog/Microsoft.Exchange.json Related to Microsoft Graph API review PR 17041579 (ADO msazure/One). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c48a2506-129a-4c08-92b3-75915015d987 * Address content review feedback on mailFolder: importMime - Align the description in front matter, the introduction, and the mailFolder methods table so all three are identical. - Reformat the mailFolderId guidance as a note. - Correct the Authorization row in the request headers table. - Apply the reviewer's suggested wording for the request example. - Remove the unsupported 'Error response' section and document the 400 Bad Request case in the Response section instead. - Add a Mail entry to the What's new topic describing importMime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c48a2506-129a-4c08-92b3-75915015d987 * Apply batched suggestions from code review Co-authored-by: Jarbas Horst <26866873+JarbasHorst@users.noreply.github.com> * Apply batched suggestions from code review Co-authored-by: Jarbas Horst <26866873+JarbasHorst@users.noreply.github.com> * Apply suggestion from @JarbasHorst --------- Co-authored-by: Yesaket <yteshale@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jarbas Horst <26866873+JarbasHorst@users.noreply.github.com> Copilot-Session: c48a2506-129a-4c08-92b3-75915015d987
1 parent 0ac6093 commit 6b14794

5 files changed

Lines changed: 145 additions & 0 deletions

File tree

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: "Automatically generated file. DO NOT MODIFY"
3+
ms.topic: include
4+
ms.localizationpriority: medium
5+
---
6+
7+
|Permission type|Least privileged permissions|Higher privileged permissions|
8+
|:---|:---|:---|
9+
|Delegated (work or school account)|Mail-Advanced.ReadWrite|Not available.|
10+
|Delegated (personal Microsoft account)|Not supported.|Not supported.|
11+
|Application|Mail-Advanced.ReadWrite.All|Not available.|

‎api-reference/beta/resources/mailfolder.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Well-known names work regardless of the locale of the user's mailbox, so the pre
6060
|[List child folders](../api/mailfolder-list-childfolders.md) |[mailFolder](mailfolder.md) collection| Get the folder collection under the specified folder. You can use the `.../me/MailFolders` shortcut to get the top-level folder collection and navigate to another folder.|
6161
|[Create child folder](../api/mailfolder-post-childfolders.md) |[mailFolder](mailfolder.md)| Create a new mailFolder under the current one by posting to the childFolders collection.|
6262
|[Create message in folder](../api/mailfolder-post-messages.md) |[message](message.md)| Create a new message in the current mailFolder by posting to the messages collection.|
63+
|[Import MIME](../api/mailfolder-importmime.md) |[message](message.md)| Create a non-draft [message](../resources/message.md) in a [mailFolder](../resources/mailfolder.md) directly from MIME content, without submitting it to transport.|
6364
|[List messages in folder](../api/mailfolder-list-messages.md) |[message](message.md) collection| Get all the messages in the signed-in user's mailbox, or those messages in a specified folder in the mailbox.|
6465
|[Update mail folder](../api/mailfolder-update.md) | [mailFolder](mailfolder.md)|Update the specified mailFolder object. |
6566
|[Delete mail search folder](../api/mailfolder-delete.md) | None |Delete the specified mailFolder object. |

‎changelog/Microsoft.Exchange.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,6 +2597,24 @@
25972597
"CreatedDateTime": "2026-06-26T06:57:05.931789Z",
25982598
"WorkloadArea": "Groups",
25992599
"SubArea": ""
2600+
},
2601+
{
2602+
"ChangeList": [
2603+
{
2604+
"Id": "9bb9c924-294e-40e2-bf43-b5332cdb619c",
2605+
"ApiChange": "Method",
2606+
"ChangedApiName": "importMime",
2607+
"ChangeType": "Addition",
2608+
"Description": "Added the [importMime](https://learn.microsoft.com/en-us/graph/api/mailfolder-importmime?view=graph-rest-beta) method to the [mailFolder](https://learn.microsoft.com/en-us/graph/api/resources/mailfolder?view=graph-rest-beta) resource.",
2609+
"Target": "mailFolder"
2610+
}
2611+
],
2612+
"Id": "9bb9c924-294e-40e2-bf43-b5332cdb619c",
2613+
"Cloud": "Prod",
2614+
"Version": "beta",
2615+
"CreatedDateTime": "2026-09-23T17:33:21.1863377Z",
2616+
"WorkloadArea": "Mail",
2617+
"SubArea": ""
26002618
}
26012619
]
26022620
}

‎concepts/whats-new-overview.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ Updated the [getSharePointApiUsage](/graph/api/reportroot-getsharepointapiusage?
142142

143143
Added the **mailboxId** property to the [group](/graph/api/resources/group?view=graph-rest-beta&preserve-view=true) resource type to identify the Exchange mailbox associated with a Microsoft 365 group. The property is returned only when specified in `$select`.
144144

145+
### Mail
146+
147+
Added the [importMime](/graph/api/mailfolder-importmime?view=graph-rest-beta&preserve-view=true) method to the [mailFolder](/graph/api/resources/mailfolder?view=graph-rest-beta&preserve-view=true) resource to create a non-draft message in a mail folder directly from MIME content. Unlike [creating a message](/graph/api/mailfolder-post-messages?view=graph-rest-beta&preserve-view=true), which always creates a draft, this method 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. Use the **importMime** API to import existing mail into a mailbox, such as to migrate messages from another system.
148+
145149
### Mail | Message trace
146150

147151
Added support to identify recalled messages in message trace. Use `recalled` as a supported value of the **status** property of the [exchangeMessageTrace](/graph/api/resources/exchangemessagetrace?view=graph-rest-beta&preserve-view=true) resource.

0 commit comments

Comments
 (0)