How to filter mails to get specific sender with MicrosoftOffice365 ? (using Query)

Hello,

I would need help about MicrosoftOffice365.Activities.Mail.GetMail activity. I am trying to get emails on my robot’s Outlook(365) inbox with a specific subject and a specific sender.

I used the following documentation https://docs.uipath.com/integrations/docs/office365-get-mail

Therefore, I complete the parameters this way :
image

It works when we do the query for the subject only. But it does not work for the from filter.
What does not work : Query for from/emailAddress/address AND query for from and subject together.

Does anyone already used the query with this activity ? Can it be a permission missing from the robot microsoft account (Microsoft Graph API permissions) ?

Thank you in advance for your help.

Hey there,
I was looking around for my issue similar to you.
I spent hours to find a solution for this. UiPath has way too many methods of getting this email filter out but here is the solution that could work with your.

“contains(subject,‘abcdcefgh’)" and “from/emailAddress/address eq ‘email@nowhere.com’”

2 Likes

Hi :smiley:
well, thank you very much for letting me know your solution.
Since 2021, we are only using Gmail. But who knows, it might be useful in a future.

Using Studio 2022.4.3
After a lot of trial and error, a case with UiPath, and interesting searching we found the best documentation (For https://docs.uipath.com/activities/docs/office365-get-mail) for the query at: Use the $filter query parameter to filter a collection of objects - Microsoft Graph | Microsoft Learn
O365 V1.11.1 works with both of the following:
“categories/any(a:a+eq+‘Red+category’)”
“contains(subject, ‘ICE’)”
But in V1.14.1 (and 1.16.1 prerelease) only the second works. The first one generates a BadRequest, Invalid filter clause.