Unable to read all outlook messages using DASL filter query

While reading outlook emails, I am using a DASL filter query to search whole mailbox.

Query: “@sql=” +""""+“urn:schemas:httpmail:subject”+""""+" LIKE ‘%%’"

The query works well if I check “Only Unread Messages” but when I try to read all the messages I am getting following error:


Source: Get Outlook Mail Messages

Message: Condition is not valid.

Exception Type: System.Runtime.InteropServices.COMException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Runtime.InteropServices.COMException: Condition is not valid.
at UiPath.Mail.Activities.GetMailActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)


UiPath Studio: 2018.4.5
UiPath.Mail.Activities: 1.5.1

Can anybody please help?

Hi @rpafactory

Check this

Ashwin S

Dear @AshwinS2 ,

Thanks for you response. Do you know how to filter email based on some text in subject? As per solution, I can check Subject for equivalence condition only. Is there any way to filter Subject using LIKE??

1 Like

Hi @rpafactory
Based on Get OutLook Mail Message

Mail Message property

For each item in MailMessage change the type as System.Net.Mail.Message

U can use contains


Dear @AshwinS2,

As there will be a large number of mails, getting all of them and iterating on each one of them will not be an efficient way. this will reduce robots performance. That’s the reason I am looking for a filter criteria.


Found solution. I am able to read all email. Root cause still not known

1 Like

I have tried using DASL Query, and it work for me and i am able to fetch read or unread message both. If i check ‘OnlyUnReadMessage’ then i get only unread message, If I uncheck ‘OnlyOnReadMessage’, I get Read message as well

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.