How to create a folder under another PST file or mailbox (not just the defaultStore)

Just wondering if this is similar way to create folder under another PST rather than just the defaultstore?

“Variable” oapp = new Microsoft.Office.Interop.Outlook.ApplicationClass

“Assign activity” oFolders = oapp.Session.GetFolderPath(“myPSTname\inbox”).Folders
//error: option strict on disallow later binding

“Assign activity” NewFolder = oFolders(“Inbox”).Folders.Add(“newFolderName”, Type.Missing)

also here is a reference for create a folder under outlook defaultStore


Hi webon99,

Have you managed to deal with this problem?

My idea is to use Microsoft HowTo code to support automation.

This is VB so it should be possible to convert it into a UIpath activity.

Hi I managed to deal with it. Thanks to various pieces of information from UI Path forum and aformentioned code!
mBoxFolderCreator.xaml (16.1 KB)


Hi, have you had to use this with shared mailbox subfolders by any chance? It works perfectly for top level outlook folders but I need to be able to look at subfolders :frowning:

you can assign below codes to create NewFolderA\NewFolderB on given Inbox folder.

This one creates only NewFolderB, NewFolderA exists:

This creates whole tree of folders:

Keep in mind that Inbox name will be different in other language versions of outlook.
There is also Outlook folder limitation of 500. After that it might cause issues like not finding folder that was created second ago.


1 Like

Thanks, this works.