Get Outlook Mail Filtering

I wanna know the filtering syntax and the limitation of the “Get Outlook Mail Message” activity.

Firstly, I tried to extract my outlook mails without filtering and use the syntax (MailMessage(0).from.ToString) to extract the sender info and the sender info I get is the following: “UiPath Help Desk” support@uipath.zendesk.com

  • Then I try to add a filter with the syntax of “[From]=‘“UiPath Help Desk” support@uipath.zendesk.com’”. There is an error of .

but the It works fine with the filter of “[From]=‘Uipath Help Desk’”. May I konw the reason for the error?

  • Also, is it possible to make the filter more dynamic, like "[From]='“UiPath Help *”.
1 Like

Yes of course it is possible. Fetch the “FROM” string in a variable(ex:str_FromName) and check whether str_FromName.contains(“Uipath Help”).
Check and let me know whether it suits to your requirements…
Thanks,
Happy Automation.
Jiban

1 Like

What do you mean by Fetching the “FROM” string?

You can try this

Thanks,
Jiban

1 Like

Hi @karlkong,
Just put this in your filter of Get outlook email message.
“@SQL=”“http://schemas.microsoft.com/mapi/proptag/0x0037001f”" like ‘%UiPath Help%’"

Try it out and let me know.

Thanks,
Avi

1 Like

image

When I was trying your solution, I got this error.

What is going wrong?

@karlkong Could you try and change the TypeArgument to MailMessage in the properties for the foreach activity. See if that works.

Yes. I’m trying to use the filter function of the get outlook message.

But I wanna know why I can’t get anything by using this syntax. “[From]=’“UiPath Help Desk” support@uipath.zendesk.com’"

HI @Avi7,
I try to find out more about your method, but i have real Problems to understand it.

Here is my issue:
I want to filter a Postbox for a specific email adress - prefix (@something.com).
I cannot use From, because it only works with what it sees aparently.
Example:
[FROM]=‘Miller Peter’ works
[FROM]=‘peter.miller@example.com’ does not work

[senderemailaddress]=‘peter.miller@example.com’ works
but how do i do
[senderemailaddress]=‘*@example.com’?

If i copy your example and adapt it,so it might work i got an error.

Example:
“@SQL=”“http://schemas.microsoft.com/mapi/proptag/0x39FE001F”" like ‘%@example.com%’"
Error:
Get Mail Failed, Reason: Cannot parse condition. Error at “@SQL=(('http://schemas.microsoft.com/map…”.

So you i would really be happy, if you could explain how i can filter for a specific mail-ending-Thing(*@example.com).
Because I cannot find much on that matter.

2 Likes

I did solve my own issue by adjusting the Code, but it only works for external mails though, but that must suffice. its only half pleasent for testing purposes.

I hope someone is learning something from my experience and discription, so here are my different Statements and what i learned:
From Statement:
“[FROM]=‘Mustermann Max’”
Sender Email Adress Statement:
“[senderemailaddress]=‘emails@testinfo.com’”
Sender Email Adress with Wildcards
“@SQL=” & Chr(34) & “http://schemas.microsoft.com/mapi/proptag/0x0065001f” & Chr(34) & " LIKE ‘%@testinfo.com’"

3 Likes

I want to extract only the subject lines from the mail from a particular person.So how can I put the filter for the name of the particular person whose mail subjects I would like to read.

I also have issue with filtering messages. I’m working on the UiPath Studio v.2018.3.3
In the activity Get outlook mail messages I put filter like:
“[FROM] = ‘NameAndSurname’”, and what I receive is error message: “Property ‘From’ is unknown”.
Any of you may know, why this error is popping out?

Regards

Hello,

What, if I need to convert the complete subject line to lowercase.image|578x500
Here I am extracting the mail and then from each mail I have to extract the subject line so could you guide a bit…

I know it has been quite a while, but I just had the same problem and found why.

My Outlook is not in English, but in French, so the property is not [FROM] but [DE] (or even [De], seems like the case don’t change anything).
So, I guess if your Outlook is not in English, you could correct this problem by changing the “From” for the translation in your language (seems like we can’t really automaize process using Outlook with UiPath if we have differents langages inside our company, or we would need to put into action a switch or to create variable with the tag like “from” and their value would change depending of our Outlook langage).

By the way, does anyone have a link with the whole documentation about this ? Because I found about Chapter 11: Searching Outlook Data | Microsoft Learn, but it’s only if you try to use the syntax with “@SQL=…” and I can’t find the usual tag like “senderemailaddress” (which I’m trying to find the French equivalent right now :smiley: ).

I used this Website to look for the appropriate MAPI Tags. This is quite helpful when you deviate from the standard:

http://www.dimastr.com/redemption/enum_MAPITags.htm

1 Like

Hi jiban
how can i get the body of specific mail in outlook
m using in through assign strBody=item.body.tostring
if
strBody.contains(“Keyword”)

is this correct approach?
Pls suggest

thanks

no
its not working
showing some error

hi jiban
in my case its not working as shown in pic
can u suggest any solution??

thanks

In trying the [FROM] = @email.com method, Studio was not giving me an error, but simply ended the execution. It wasn’t until I removed the filter, did the automation continue. I’ve commented on another Get Outlook Mail Filtering post and hoping someone has an update to this. I’d like to filter based on a wildcard instead of exact emails.

You can use

lstMails.AsEnumerable.where((function(x) x.Sender.Address= In_FromAddress and x.Subject=In_Subject)).tolist

In_From address and In_Subject are arguments

1 Like