Hi, I’m trying to build a robot that count the email in the “inbox” and in all the subfolders of “inbox”. It works with folder at the same level (such as: draft, sent, etc.) but not on the subfolders created under “inbox”.
Any suggestion?
Hi, I’m trying to build a robot that count the email in the “inbox” and in all the subfolders of “inbox”. It works with folder at the same level (such as: draft, sent, etc.) but not on the subfolders created under “inbox”.
Any suggestion?
Hello @Giovanni_Mac ,
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(“YourEmail@gmail.com”).Folders(“Inbox”)
For Each olFolderA In olParentFolder.Folders
Msgbox(olFolderA.FolderPath)
'Msgbox(olFolderA.FolderPath, olFolderA.Items.Count, olFolderA.Folders.Count)
For Each olFolderB In olFolderA.Folders
Msgbox(olFolderB.FolderPath)
'Msgbox(olFolderB.FolderPath, olFolderB.Items.Count)
Next
Next
Sorry, I didn’t get it. I have to put this code in the “MailFolder” field in the input? I’m not using a GMAIL account but a corporate one… it is the same?
Hi @Giovanni_Mac ,
Can you please try “Inbox/subfolder” in MailFolder, I haven’t tried it, but i guess it will work, please let me know if it does.
Thanks,
Ganesh Dongre.
Hello,
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(“YourEmail@outlook.com ”).Folders(“Inbox”)
For Each olFolderA In olParentFolder.Folders
Console.WriteLine(olFolderA.FolderPath)
OutlookFolderNames.Add(olFolderA.FolderPath)
Next
In the Place of YourEmail@outlook.com put your Email Id from which you wanted to retrieve mail Items.
Click on Edit Arguments and : Pass a List(Of String) OutlookFolderNames Variable to hold the value of Subfolder Paths
Refer the below Screenshots for more details :
Now you have all the Subfolder Paths in a List Variable
Regards,
Rohith
Doesn’t work for me…
Not sure how to use it but till now I’ve solved almost everything. Unique problem… Arguments and variable with List is giving me some pain
Hello @Giovanni_Mac ,
You are using wrong data type. Kindly select the below data type for argument in Invoke code.
System.Collection.Generic.List(Of String)
Hello Giovanni! Can you please tell me how did you get the main folders? (Inbox, Draft, Sent…)
Thanks!
late reply but this does work if you use a back slash “Inbox\subfolder”.
when you run the code given by Rohith, you will get a response as the following for each subfolder - \youremail@outlook.com\Inbox\subfolder". You dont need your email included since it is already given in the activity.