"Received mail" from /me/mailFolders/inbox/messages misses Inbox subfolders — and /me/messages includes Sent Items
GET /me/mailFolders/inbox/messages returns only messages that sit directly in the Inbox — mail that a rule moved into an Inbox subfolder is not there. GET /me/messages is the whole mailbox, including Sent Items, Drafts and Deleted Items. For a "mail I received" overview, read /me/messages with parentFolderId in $select and drop the well-known non-received folders on the client.
GET /me/mailFolders/inbox/messages vrací jen zprávy PŘÍMO v Doručené poště – e-mail, který pravidlo přesunulo do podsložky, v ní není. GET /me/messages je celá schránka včetně Odeslané, Konceptů a Odstraněné pošty. Pro přehled „co mi přišlo“ čti /me/messages s parentFolderId v $select a dobře známé složky, které přijatou poštou nejsou, vyřaď na klientovi.
Symptom
An "awaiting reply" or "what came in today" widget works for most users, but someone who sorts mail with Outlook rules says the widget never shows the messages in their project folders. The opposite bug shows up in a "recent mail" feature built on /me/messages: the user's own sent replies are listed as if someone had sent them.
Cause
- A folder's
messagescollection contains only the messages in that folder. Subfolders are separatechildFolderswith their ownmessagescollections, and you reach them by walking the folder tree; the request does not recurse. We saw this with a real user whose rules sorted mail into Inbox subfolders (2026-11-19). /me/messagesgets all the messages in the user's mailbox, in every folder. In the same case, the user's own replies from Sent Items came back alongside received mail.
Neither is "mail I received".
Fix
Resolve the IDs of the folders that do not hold received mail, by their well-known names, once per page load:
GET /me/mailFolders/sentitems?$select=id GET /me/mailFolders/drafts?$select=id GET /me/mailFolders/deleteditems?$select=id GET /me/mailFolders/junkemail?$select=id GET /me/mailFolders/outbox?$select=id GET /me/mailFolders/archive?$select=id GET /me/mailFolders/conversationhistory?$select=idIf one of these lookups fails (for example, a mailbox without an Archive folder), don't exclude that folder; carry on with the rest.
Read the whole mailbox, newest first, with the folder of each message:
GET /me/messages?$select=id,subject,receivedDateTime,from,conversationId,parentFolderId &$orderby=receivedDateTime desc&$top=<3 × what you show>A date window works as
$filter=receivedDateTime ge 2026-11-05T00:00:00Z— the filter property is the same as the$orderbyproperty.Drop messages whose
parentFolderIdis one of the IDs from step 1, then cut to the size you show. Take a larger sample than you need, because the excluded messages are removed only after the read.If Sent Items or Deleted Items could not be resolved (network error, missing consent), fall back to
/me/mailFolders/inbox/messagesand don't cache that incomplete result. A narrower list is better than showing the user's own sent mail as received.
We filter on the client rather than with parentFolderId ne '…' on the server. When $filter and $orderby are used together on messages, the properties in $orderby must also appear in $filter, in the same order and before any others, otherwise the request fails with InefficientFilter. We have not tested ne on the folder under those rules.
When Inbox-only is right
Keep reading /me/mailFolders/inbox/messages when the feature acts on the Inbox itself. Examples are triage that archives messages, which must not pull mail out of folders a rule already sorted it into, and intake from a shared mailbox's Inbox. Write down which group each caller belongs to.
Sources
- List messages – Microsoft Graph v1.0 –
/me/messagesversus/me/mailFolders/{id}/messages, and the rules for$filterwith$orderby - mailFolder resource type – well-known folder names
- Organize Outlook messages – folders under the Inbox, reached through
childFolders