Search for emails in Graph API with $search as a number

murayama 1 Reputation point
2021-08-13T04:12:36.263+00:00

Hello.
I would like to search for a Japanese email title or body that contains a number and a string without spaces, such as "2ken", "4ken", and "6ken", and only those that contain "2".

I think I need to use $search to search for body, but I could not get "2ken" in the following query.

https://graph.microsoft.com/v1.0/me/messages?$search="2"

Is there any documentation on searching for these words? Also, is this a specification?

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

1 answer

Sort by: Most helpful
  1. ShivaniRai-MSFT 2,726 Reputation points
    2022-02-23T16:15:04.077+00:00

    Hi @murayama ,

    I am also able to replicate the above mentioned issue. $Search Graph Query parameter allows Full-text search on messages. You have to provide full text i.e. '2ken' in order to search for this type of text. Also, Graph API search parameter works same as search functionality works in Outlook UI.

    For your reference I am attaching example screenshot from Outlook UI:
    Here If I search with '2' only, I am not able to get messages with body '2ken':
    177302-image.png

    If I search with '2ken' then only I am able to get messages with this '2ken' body:
    177301-image.png

    Graph API works exactly the same way. So, we can say its more of a specification of search functionality of Outlook.

    Reference Docs:
    https://learn.microsoft.com/en-us/graph/search-query-parameter#using-search-on-message-collections

    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.

    0 comments No comments