1

I am searching inbox messages using MS Graph API. Here is the request

https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages?$search="attachment:blabla"&$count=true

I have also set the header to "ConsistencyLevel”: “eventual”

After executing the request, I don't see @odata.count in my response. I do see other keys in my response like @odata.context and value

To me it looks like search and count are not working together. correct me if I am wrong?

I am following the documentation from here https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-beta&tabs=http#optional-query-parameters.

Any insights in the right direction is highly appreciated. Thank you

  • If you are using the above call make sure you have a txt file as attachment having blabla word in it and test it. You will be able to see the message having the blabla keyword in your attachment. If you want to get the count of attachments for a particular keyword, you need to first search on /messages endpoint, get the id of the message and put it in /messages/{messageid}/attachments?$count=true which gives the count of all attachments in a message irrespective of keyword. – Shiva Keshav Varma Nov 19 '20 at 12:10
  • Thank you for your comment. I have the blabla word in my attachment. The request should still give the count of all the messages which contains the blabla word in it right? I also tried with another request like https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages?$search="subject:blabla"&$count=true still I don't get the count value. – Vinothkumar Mohanakrishnan Nov 19 '20 at 13:56
  • The above search query is not intended for your above use case. Also i am not aware of any other API exists suits you. – Dev Apr 21 '21 at 05:19

0 Answers0