I am about to create a processes that is to be used to verify the work of another process that recently was put into production.
One part of this new process is to check if an email has been sent to a certain address. To do this I am using the O365 Get mail activity with an odata filter expression.
As far as I can understand the following expression should do the trick:
“$filter=toRecipients/any(t:t/emailAddress/address eq ‘xxx.yyy@zzz.com’)”
But I get this error message:
Message: Code: BadRequest
Message: Invalid filter clause: ‘)’ or operator expected at position 55 in ‘(receivedDateTime ge 1900-01-01T00:00:00Z) and ($filter=toRecipients/any(t:t/emailAddress/address eq ‘xxx.yyy@zzz.com’))’.
I am by no means an expert on odata filters, but to me it seems like the get mail activity add that first part that checks received date time and then put my expression in a parenthesis as a second part. What I understand you can not have the filter “statement” inside a parenthesis and this can be the cause of the error.
Hey @jerry.lundgren1
You should remove the $filter= part from your filter string and only include the actual logical condition
toRecipients/any(t:t/emailAddress/address eq ‘xxx.yyy@zzz.com’)
Make sure:
You use single quotes ’ (not curly quotes like ‘ or ’).
You don’t wrap the entire thing in another $filter=, as UiPath handles that.
So the full final filter applied by UiPath would become something like:
$filter=(receivedDateTime ge 1900-01-01T00:00:00Z) and (toRecipients/any(t:t/emailAddress/address eq ‘xxx.yyy@zzz.com’))
Which is now a valid OData filter.
Thank you for clarifying how to format these odata filter expressions. But I just can’t get this to work and i have a suspicion that the “toRecipients” property is not compatible with filter expressions. While googling I have seen some comments here and there that it can be that way.
I can get other variants of odata filter to function as I want, just not with “toRecipients”.