Is there any way to get only the first outlook message that fits a filtering criteria? For instance let’s say I have 3 emails in my inbox. I want it to search the subject lines until it finds my filtering criteria. After it finds the first one I want it to stop looking for other messeges. So if my subject line was found in email 2 it wouldn’t go look at email 3. Email 3 would also have the correct filtering but I want to process that on the second run of the automation
In the Get Outlook Mail Messages activity set the Top Property to 1,then it will get one mail alone.
Filter you need to pass based on your conditions.
Yah that’s possible
In Get Outlook Mail Activity along the property Filter set the filter like this
“[Subject] = ‘your subject’ “
If we want to check any word like kind of condition then use this expression
“SQL=urn:schemas:httpmail:subject like ‘%your keyword%’ “
Then in the TOPproperty set as 0 so that it will first filter the mail with the subject condition specified and then from that it will take the first mail alone
That’s all you are done
Hope this would help you
Hey, I try it and it does not seem to work. Is there something wrong with my syntax? this is what I am typing:
Also, is it possible to use contains instead of equals?
you were almost done
the expression be like this
“[Subject] = ‘test’ ”
yah to check like contains or not
the expression be like this
"SQL=urn:schemas:httpmail:subject like ‘%test%’ "
Just tried the sql one and i got an 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)
your filter condition looks fine
but here the TOP property is set as 0
thats why we dont get any mail
–so mention some value more than 0 so that it will fetch some mail from the inbox
I thought you told me to set the top property to 0.
I tried changing that number but it still does not work…
Okay I actually figured it out. I used a different approach:
I just used the break activity to jump out of the foreach after it found the first one.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.