Using Graph API to search email body content for string that has a hash

Paul Hawkes 0 Reputation points

I am searching an inbox looking for the term "#resolved" in the body of the email - I would like an exact match for the search string.

I have used this :$search="body:#resolved" This GET request will return nothing.

If I percent encode the # tag:$search="body:%23resolved" then this GET will return all mail with "resolved" in the body ignoring the # tag.

What should I be doing to just return the emails that have #resolved in their body?

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

1 answer

Sort by: Most helpful
  1. v-pd 5 Reputation points Microsoft Vendor

    When you use$search="body:#resolved", the API is likely treating #resolved as a special syntax, hence returning no results. When you percent encode the # tag:$search="body:%23resolved", the API ignores the # tag and returns all mail with “resolved” in the body.

    0 comments No comments