Share via

About the parameters of https://graph.microsoft.com/v1.0/me/messages

dla-d 0 Reputation points
2025-08-27T04:08:35.27+00:00

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.

Exchange | Licensing
Exchange | Licensing

The framework for legally deploying and using Microsoft Exchange Server or Exchange Online, based on server and client access models.

0 comments No comments

3 answers

Sort by: Most helpful
  1. dla-d 0 Reputation points
    2025-08-28T08:47:23.15+00:00

    I understand. Thank you

    Was this answer helpful?


  2. Adiba Khan 2,345 Reputation points Microsoft External Staff
    2025-08-27T09:13:34.13+00:00

    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.

     

    Was this answer helpful?

    0 comments No comments

  3. Kudos-Ng 15,050 Reputation points Microsoft External Staff Moderator
    2025-08-27T08:37:41.6966667+00:00

    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: 

    • The query 1:
      https://graph.microsoft.com/v1.0/me/messages?$search="from:******@xxx.co.jp" and "to:******@xxx.co.jp"&$filter=startswith(Subject, 'test20250826') 
      correctly returns only mail①
    • But the query 2:
      https://graph.microsoft.com/v1.0/me/messages?$search="from:******@xxx.co.jp" and "to:******@xxx.co.jp" and "Subject:test20250826" 
      unexpectedly returns both mail① and mail②, even though only mail① matches the subject exactly. 

    Based on your context, I reviewed several examples from Microsoft’s documentation and found a few key points that may help clarify this behavior: 

    1. Case Sensitivity in Property Names 
      In your second query, you're using Subject:test20250826 with a capital "S". However, most examples in the documentation use lowercase property names like subject:undefined undefined
    2. Search Syntax Behavior 
      According to Search Tips from Exchange Message Properties, the syntax should follow the format:  undefined property:value 
      • Values are not case-sensitive 
      • Property names may be case-sensitive (not explicitly stated, but implied through examples and behavior) 

    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. 

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.