AND is not working in the search for graph api


API:*********/mailFolders/Inbox/messages?$search="subject:Request***" AND "from:test@test .com" AND "to:test@test .com"

I am using multiple conditions in the search with graph api. However, the AND condition is not working as expected. It is giving result when either of the criteria is met like OR.

Can you please check and can provide some solution

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,889 questions
0 comments No comments
{count} votes

Accepted answer
  1. Srinivasa Rao Darna 6,696 Reputation points Microsoft Vendor

    Hi @Anonymous ,

    I think there is a small correction to the condition’s syntax in search query.

    Replace $search="subject:Request***" AND "" AND”
    With $search="subject:Request*** AND AND"
    Put all conditions within "" not like $search=”condition1” AND “Condition2” AND “condition3”

    Response with AND conditions in search query:

    Hope this helps.
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

1 additional answer

Sort by: Most helpful
  1. Olaf Helper 41,571 Reputation points

    the AND condition is not working as expected

    Why do you think AND is the key for a logical operator in the URL? It's the ampersand sign &