Get Outlook Email filter?

So far I’m testing with various syntax of the ‘filter’ category of the Get Outlook Email, but I’ve come short of a problem.

These 2:

“[senderemailaddress]=‘xx@email.com’”

or

“[from]=‘xx@email.com’”

Both doesn’t seem to work, and from what I’ve tried, the ‘from’ syntax only applies to names of the emails, which isn’t exactly what I needed - my filter is strictly based from a certain email address; while the ‘senderemailaddress’ doesn’t even work at all!

Any thoughts on this?

@McDonalds,

Follow these steps for extracting senders email address:

  1. Get outlook mail messages
  2. Foreach item in mailMessages
     senderMail = item.To.Tostring

Hi,
Please follow this chain and let us know if this works for you.

Or try this : “[From]=‘YOurmailID’”

Regards,
Pavan H

Hey laksh, the “To” did work, but I wanted to go for a filter through a person’s email :sob:

Thanks for your response!

Hey pavan, thanks for the response.

Mine wasn’t that complicated though, I just ran a for-each, attempting to print out each iteration of emailmessage (item.from.tostring or item.sender.tostring), but both returned me nil results. Kind of purplexing if you ask me. I’m able to retrieve all other details like the email subject, body etc (e.g item.subject.tostring) but just not the ‘sender’ email address.

As for going for the username in ‘From’, it did work as an alternative - but it isn’t what I intended, I wanted to filter through a person’s email, not by their username…

Hi,

For sender mail Id use this “[senderemailaddress]=‘mailID@example.com’”
Try this and let us know if this works

Regards,
Pavan H

1 Like

Hi @McDonalds,

Try this inside for each loop mail.sender.address.tostring

This will work let us know the result

Regards,
Pavan H

1 Like

Hi @McDonalds

did u tried this

@SQL=(urn:schemas:httpmail:fromemail LIKE ‘%emailId%’")

hey pavan.

Thanks for your suggestion for this! Sadly though, both methods that I previously tried did not work - the senderemailaddress jet syntax didn’t seem to return any results at all - the search output listed nothing.

For ‘mail.sender.address.tostring’, my previous and current attempts still gave me nothing - no value listed. (null reference error)

My guess is that there’s an issue with the UiPath get outlook mail activity - it wasn’t grabbing the sender’s information at all, and it’s kind of frustrating onto that

@McDonalds

Maybe give a try with linq, Below code will read all mail from there you can do any sort of custom select using linq. Execution speed is more or less the same. So this will help in further filtering.

Get mail with filter.xaml (7.7 KB)

2 Likes

Hey amaresan, this method did work, it’s the closest possible answer to what I’m looking for (to filter check with an email address). I probably would accept this as a temporary solution if there aren’t any other workarounds (to filter for the full email addr)…thanks!

P/N: For experimental sake I tried some varying emails onto this - this solution was the most accurate when tested it with just the emailid. It worked sometimes when using the full email address, but sometimes not, only identifying mails if I just use the emailid :sweat:

Hey ragu :smile:, I tried your solution, but somehow there aren’t any hits returned.

I’ve narrowed the error down to the variable assign part: somehow “list_ReadMail.AsEnumerable.where(Function(x) x.Sender.Address = “myemail@gmail.com”).tolist” wasn’t able to give anything, hence the error.

As a precaution, I checked my inbox - the email is still inside there, and is correctly listed as per the get outlook email properties (within the top amount, in the correct folder, my email id being correct etcra)

@McDonalds

After geting list_ReadMail use for each and pass this list there.

Then have a message box inside and pass below string into message box content.

item.Sender.Address

This will show you mail address of mail captured in list

Dont for get to change Type Argument of For Each activity to MailMessage.

Hey ragu, there are still no hits returned though. I did a check to see if there are any values in the list prior to the for each activity, using a ‘list_readmail.count.tostring’. It returned a ‘0’, indicating that there wasn’t anything matched.

I suspect that the ‘x.Sender.Address’ of the syntax wasn’t holding anything at all, hence it wasn’t matching any results - which is what the program did correctly!

My next thing I did was to modify your line into:
“list_ReadMail.AsEnumerable.tolist",
subsequently placing the list in a foreach activity, printing out “item.sender.address”… it did return me a correct sender’s address! Thus further adding weight to my theory. Very purplexing.

:+1: for your response

Then @McDonalds, there is something wrong with your outlook.

This is not issue with linq i shared, your get outlook mail activity is where the issue is.

Case 1: 2 outlooks configured.
Case 2: Uncheck Only unread check box in Get outlook mail activity properties.
image
Case 3: Remove all filters from get outlook mail activity

1 Like

Is your issue solved?

I have to give your post a :+1: for the fast response, as well as a bonus pict inside, lol.

I suspect it would be the ‘get outlook mail’ activity being incomplete - I only have 1 outlook account on my pc; the onlyunreadmessages were unchecked for my this entire process from the get-go; and there weren’t any filters at all for the ‘get outlook mail’ activity.

I remember going through a thread about this similar issue in this forum (mod reply in May 18), and it was a missing feature in the activity itself. I thought it would be fixed in the latest community update in Mar 19, but I guess I was wrong. :roll_eyes::roll_eyes:

@McDonalds

Ill still keep at note on this issue, If you query is resolved make solution.

1 Like

Final P/N into this thread for reference:

This issue happens when you use subfolders in inbox (e.g Inbox\folder1)

If not, it’s smooth sailing

Hey @McDonalds, send your workflowwe will have a look into it and solve the issue, it’s not the issue with subfolder.

Regards,
Pavan H