Reading outlook emails from multiple custom subfolders


I want to get all outlook mails from multiple sub folders. I am able to get mail for one sub folders but not from multiple folders.Could you please suggest any way out.


If you know the names of the folders, keep them in an Array and do a foreach and use Get Outlook Email activity inside with Folder as Variable.

For dynamic names, I will do some research in Uipath and get back to you.


If you already have the workflow to get the mail from Outlook.please forward to my official email ID

Hi bala0402,

FYI.OutlookSample.xaml (8.0 KB) by Paddy :slight_smile:

If folder structure is dynamic or keep appending upon time please do first get all the folders and subfolders list using the below approach and use get outlook activity to iterate to retrieve emails :slight_smile: hope this helps.

Here we go using Invoke VBA option. You can write VBA code to update the output to an excel. Here used just a Messagebox. Also to further enhance as per your requirement try writing the same in excel VBA code :slight_smile:

Invoke Code( Workflow- Invoke- Invoke Code)

Dim olApp As Microsoft.Office.Interop.Outlook.Application
Dim olNs As Microsoft.Office.Interop.Outlook.Namespace
Dim olParentFolder As Microsoft.Office.Interop.Outlook.MAPIFolder
Dim olFolderA As Microsoft.Office.Interop.Outlook.MAPIFolder
Dim olFolderB As Microsoft.Office.Interop.Outlook.MAPIFolder
olApp = New Microsoft.Office.Interop.Outlook.Application
olNs = olApp.GetNamespace(“MAPI”)
olParentFolder = olNs.Folders("").Folders(“Inbox”)
For Each olFolderA In olParentFolder.Folders
'Msgbox(olFolderA.FolderPath, olFolderA.Items.Count, olFolderA.Folders.Count)
For Each olFolderB In olFolderA.Folders
'Msgbox(olFolderB.FolderPath, olFolderB.Items.Count)