The framework for legally deploying and using Microsoft Exchange Server or Exchange Online, based on server and client access models.
I understand. Thank you
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I apologize if the selected tag was incorrect.
The following two emails exist in your mailbox:
mail①
from:******@xxx.co.jp
to:******@xxx.co.jp
Subject:test20250826
mail②
from:******@xxx.co.jp
to:******@xxx.co.jp
Subject:test20250825
If you run the following:
https://graph.microsoft.com/v1.0/me/messages?$search="from:******@xxx.co.jp" and "to:******@xxx.co.jp"&$filter=startswith(Subject, 'test20250826')
Only mail① is found in the search ⇒ Correct
https://graph.microsoft.com/v1.0/me/messages?$search="from:******@xxx.co.jp" and "to:******@xxx.co.jp" and "Subject:test20250826"
Both emails ① and ② are retrieved by the search.
⇒Is the above syntax incorrect? Please tell me the correct syntax.
The framework for legally deploying and using Microsoft Exchange Server or Exchange Online, based on server and client access models.
Here’s the correct syntax:
https://graph.microsoft.com/v1.0/me/messages?$search="from:******@xxx.co.jp" and "to:******@xxx.co.jp"&$filter= subject eq 'test20250826'.
· Use $search only for fields like from, to, cc, bcc, body, attachment, etc.
· Use $filter for exact field filtering (like subject eq, startswith, recievedDateTime, etc.)
· $search is full-text search-> it’s not reliable for exact subject matching.
Hi dla-d,
Thank you for posting your question in the Microsoft Q&A forum.
From what I understand, you're testing Microsoft Graph API search queries to retrieve specific emails from your mailbox. You’ve observed that:
https://graph.microsoft.com/v1.0/me/messages?$search="from:******@xxx.co.jp" and "to:******@xxx.co.jp"&$filter=startswith(Subject, 'test20250826') https://graph.microsoft.com/v1.0/me/messages?$search="from:******@xxx.co.jp" and "to:******@xxx.co.jp" and "Subject:test20250826" Based on your context, I reviewed several examples from Microsoft’s documentation and found a few key points that may help clarify this behavior:
Subject:test20250826 with a capital "S". However, most examples in the documentation use lowercase property names like subject:. property:value
So, you can try modifying your query to use lowercase for the property name to test if result return is correct:
https://graph.microsoft.com/v1.0/me/messages?$search="from:******@xxx.co.jp" and "to:******@xxx.co.jp" and "subject:test20250826"
References:
I hope the information above helpful. Let me know if you'd like exploring alternative filtering methods or having any further questions!
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.