How to check if outlook folder exist

Hello All,

Could you please let me know, how can I check if yesterday date folder is available or not

Hi @Chirag1991

Can you elaborate what kind of folder you’re talking about?

Hello I have subfolder like inbox\bruo\17/03/2020.

I need to check whether in outlook 17/03/2020 is available or not

Hai @Chirag1991 … Check whether it’s available or not by Using Folder exist activity(or) path exist activity … Provide the path of the yesterday’s folder

If you want to check existence of a folder in your desktop folders, you can use Path Exists activity and specify the PathType as Folder.
But if you are looking to find a folder in outlook, Please find below steps-

  1. Generate selector as combination of Base Selector + Dynamic Selector

    Base Selector: Is static. Mention as is.
    strSelector = "<wnd app='outlook.exe' cls='rctrl_renwnd32' title='*Outlook' /><uia cls='NetUITreeView' name='Mail Folders' />"
    Dynamic Selector: You can consider this also as static if the folder names wont change during processing.
    If the folder names are dynamic, then you have to loop through the folder names and create dynamic selector as below-
    a. Split the sub folder names(strOutlookFolder) into an array,
    arOutlookFolders = Split(strOutlookFolder, "/")
    b. Loop through each item(Specify Object type in properties as string) and generate selector,
    for each(var folder in arOutlookFolders)
    strSelector = strSelector + “<uia cls='NetUIWBTreeDisplayNode' name='" + folder + "' />
  2. Now open Outlook/Attach to outlook window
  3. Check element exists and specify the dynamic selector created above, strSelector

Hope this helps!

1 Like

Hello @Chirag1991 ,

You could also utilize the Microsoft.Office.Interop.Outlook namespace by writing a simple custom activity.

Hope you find what you’re looking for :slight_smile:

Please use below component

1 Like

could you send me an example xaml if you have any

Check this.
CheckOutlookFolderExistence.xaml (8.8 KB)

Thanks a lot I will try. I can see there is one activity missing and I am not able to fetch it.

the activity come after log message has value “inside outlook Scope” could you send me pictures or screenshot what is that activity you have used


Check the ErrorList tab and see which package is said as missing.
Then Go to Manage packages and add that.