Hello Wonderfull People,
I would really appreciated your help or advide on this problem:
i need an activity (if there is one…?) to let me go through all subfolders in my outlook (like a loop).
Exemple: i need the robot to acces de inbox . Then access the subfolder “ATCP” to apply my code, and then, to access subfolder “BEGR” and continuing with all subfolders like a loop until the last subfolder “XTL - XTL”
I am using a “Get Outlook Mail Message” activity . In the MailFolder property, i can set inbox , but i dont know how to make or set instruction to go to ALL subfolders…
Any help or advise will be much appreciated,
Thanks
Ricchch
Here is a work around for your scenario, refer to this thread, it explains how to get the subfolder names from the outlook using VBA and then loop through each folder to read the emails.
Hello @vishal.kp ,
thanks for helping.
I’m new in programing and in UiPath. I’ve never use Invoke Code.
Would you please give some reference to understand the meaning on this code:
“i wrote before some references (line1 to n) to better understand what make each line of the code, just to see how can those lines can help me and reuse it on my workflow”
Use Invoke Code activity, click on Edit code and Copy paste the below given code.
(line1)Dim olApp As Microsoft.Office.Interop.Outlook.Application
(line2)Dim olNs As Microsoft.Office.Interop.Outlook.Namespace
(line3)Dim olParentFolder As Microsoft.Office.Interop.Outlook.MAPIFolder
(line4)Dim olFolderA As Microsoft.Office.Interop.Outlook.MAPIFolder
(line5)Dim olFolderB As Microsoft.Office.Interop.Outlook.MAPIFolder
(line6)olApp = New Microsoft.Office.Interop.Outlook.Application
(line7)olNs = olApp.GetNamespace(“MAPI”)
(line8)olParentFolder = olNs.Folders(“[YourEmail@outlook.com]
(line9)((mailto:YourEmail@outlook.com) ”).Folders(“Inbox”)
(line10)For Each olFolderA In olParentFolder.Folders
Console.WriteLine(olFolderA.FolderPath) OutlookFolderNames.Add(olFolderA.FolderPath)
Hello @Ashish_Soni ,
thanks for helping.
Would you please give me an exemple on how to set up this advice.
specially about the split by delimiter
Sorry i am new in UiPath and a little in programing.
Thanks,
Ricchch
The line 1 to 5 is just the initialization of the variables required in the code.
From 6 here’s the explaination:
olApp = New Microsoft.Office.Interop.Outlook.Application: This line creates a new instance of the Outlook application and assigns it to the olApp variable.
olNs = olApp.GetNamespace(“MAPI”): This line retrieves the MAPI namespace from the Outlook application and assigns it to the olNs variable.
olParentFolder = olNs.Folders("YourEmail@outlook.com ").Folders(“Inbox”): This line retrieves the Inbox folder for the specified email account and assigns it to the olParentFolder variable.
For Each olFolderA In olParentFolder.Folders: This line starts a loop that iterates through each subfolder of the Inbox folder.
Console.WriteLine(olFolderA.FolderPath): This line writes the folder path of the current subfolder to the console.
OutlookFolderNames.Add(olFolderA.FolderPath): This line adds the folder path of the current subfolder to a list called OutlookFolderNames