Find Outlook Email in subfolders

outlook

#1

Hi folks,

I want to know if a mailbox contains an email from a specific email address. The email may be in a subfolder (or subfolder or a subfolder).

Using outlook manually I can enter the email address into the searchbar and change the dropdown to search All Outlook items.

Output just needs to be Boolean - one or more emails from the specifies email address exist - or none exist.

I thought I could use Get Outlook Messages with a filter, but this only filters the specified folder.

Can anyone think of a simple way of achieving this?

Many thanks,

John


#2

Another thread lead me to this article: https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/cc513841(v=office.12)

It suggests that Outlook.OlSearchScope.olSearchScopeAllFolders can be used to search all folders. The article also includes a sample script. However, I have no idea how to apply this snippit of code in UIPath to achieve the objective of establishing whether any emails in the mailbox contain a specified email address.

Note - we are actually on Outlook 2016, but I’m assuming the syntax is still valid.