question

SriramV-4649 avatar image
0 Votes"
SriramV-4649 asked SriramV-4649 commented

Graph query options as applicatoin

Hi Community,

I am running a very simple query to fetch messages from a folder with specific keywords or with subject text or even a timestamp but I am always returned all messages irrespective of the filter. Here are a couple of samples. What am I missing ?

"https://graph.microsoft.com/v1.0/users('userupn')/mailFolders('Inbox')/messages?$search=tenant"
"https://graph.microsoft.com/v1.0/users('userupn')/mailFolders('Inbox')/messages?$filter=subject eq 'Collections on date'"
"https://graph.microsoft.com/v1.0/users('userupn')/messages?$filter=(from/emailAddress/address) eq 'admin-notify@domain.com'"

Any of these queries return all messages from the specific inbox folder.

Thank You.

microsoft-graph-mail
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

GlenScales-6756 avatar image
0 Votes"
GlenScales-6756 answered SriramV-4649 commented

What code are you using to make the query, I've seen this happen in Powershell you don't escape the $ in Filter so what gets sent on the wire is something like

/v1.0/me/mailFolders('Inbox')/messages?=subject eq 'Collections on date'"

The graph doesn't return an error in this case it just returns all the Messages so you might want to use something like fiddler to see what you actually sending to the server

· 1
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.

Perfect, thank you. I was using powershell and it was consider $search as a variable. Upon escaping that, I got the right results.

0 Votes 0 ·