How to Filter mails in Office 365 using Get mail activity?

Hi, I am using office 365 to read mails, I have few scenario on the queries used for filtering mail.

  1. Lets say I need to filter only todays mail, in this case what query do i need to go with
    I tried with “ReceivedDateTime eq “'+now.ToString(“yyyy-MM-dd”).tostring+”'”
    it did not work… Bad request it seems
  2. Lets say i want see the date of mail recieved
    i used mail.Header(“Date”).tostring … it is returning null value
  3. Lets say i want to filter based on subjects
    i used “subject eq '”+str_sub1+“’ and subject eq '”+ str_sub2+“'”
    It seems a bad request.
    any sources would be great help. Happy automation.

Please try like this…

“@SQL=”“urn:schemas:httpmail:datereceived”" >= ‘%today%’ " ==> This will extract the email which you received today…

Sample Screenshot :

For Each

These search queries do not work with Office 365 / Get Mail activity.

After a lot of trial and error, a case with UiPath, and interesting searching we found the best documentation (For 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:
“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.

1 Like