question

murayama-5130 avatar image
0 Votes"
murayama-5130 asked ShivaniRai-MSFT-7217 edited

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

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-mailmicrosoft-graph-query-parameters
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ShivaniRai-MSFT-7217 avatar image
0 Votes"
ShivaniRai-MSFT-7217 answered ShivaniRai-MSFT-7217 edited

Hi @murayama-5130 ,

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://docs.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.


image.png (34.6 KiB)
image.png (55.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.