Share via

Graph API Message Search - Problem with AND

Anonymous
2024-04-19T13:28:37.5733333+00:00

The top param doesnt really matter because search only return 275 results max anyway, so ignore that aspect.

If I remove everything from the AND statement onwards and just search for body, it works fine. However, I need the received date of the message to also be factored into the search query. I have tried a million diff ways and it doesnt seem to work out. I get results, but they are not correct. Not a fan of the $search syntax... TY

https://graph.microsoft.com/beta/users/******@gannett.com/messages?$Top=500&$search="body:Want to opt out, or control how these messages are sent" AND "received<=03/27/2024"

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. CharanyaB-MSFT 1,896 Reputation points
    2024-05-21T17:54:42.7366667+00:00

    Hello @Barone, Lou,

    Thanks for choosing Microsoft.

    I tried the above API and I am able to replicate your issue. As a temporary solution, you may utilize the Microsoft Graph Search API to search for messages in a user's mailbox. Please consult the following documentation on how to employ the API.

    https://learn.microsoft.com/en-us/graph/search-concept-messages#example-1-search-messages-in-a-users-mailbox

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    Was this answer helpful?


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.