I am trying to walk outlook public folders and I just can't figure out how to do this dynamically. It is possible for me to have a public folder, that has multiple sub folders, which can have multiple sub folders. (oy! what a mess) I need to make a way to read each public folder and each subfolder from a specific starting location.
Add-Type -assembly "Microsoft.Office.Interop.Outlook"$Outlook = New-Object -comobject Outlook.Application$namespace = $Outlook.GetNameSpace("MAPI")$public_folder = $namespace.Folders.Item("Public Folders - <my account>")$public_folders = $public_folder.folders.item("All Public Folders")$public_r1 = $public_folders.folders.item("R1")$public_a= $public_r1.folders.item("Public folder name 1")$public_v = $public_a.folders.item("Public folder name 2")$public_business = $public_v.folders.item("public folder name 3")
I don't get to use cool exchange powershell scripts. It's MAPI namespace for me. I understand that means the only way to see folders is to use folders.item..
Does anyone have a powershell script that has done something similar?
Use the DOM to capture the full path to the object in a collection, and loop through them, just as you would with the file system and folders.