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!
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…
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
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.
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
Hey ragu , 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)
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.
I have to give your post a 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.