I was wondering how to datamine a pst file beyond it's primary folders to see if an empty folder has content in a subfolder and add it to an existing psobject?
Cheers,
B.
$results = New-Object System.Collections.ArrayList # Empty Array $null = Add-type -assembly Microsoft.Office.Interop.Outlook $outlook = new-object -comobject outlook.application $namespace = $outlook.GetNameSpace('MAPI') $pstpath = "d:\sample.pst" $namespace.AddStore($pstpath) $PST = $namespace.Stores | ? {$_.FilePath -eq $pstpath} $PSTRoot = $PST.GetRootFolder() $PSTName = $PST.Displayname Foreach ($folders in $PSTRoot.Folders) { $x = $folders.Name $y = $folders.FolderPath $z = $folders.Items.Count $Object = New-Object PSObject $Object | Add-Member -Name 'Name' -MemberType Noteproperty -Value $x $Object | Add-Member -Name 'Path' -MemberType Noteproperty -Value $y $Object | Add-Member -Name 'Items' -MemberType Noteproperty -Value $z $results += $object } $results | Format-Table 'Name','Path','Items' -Wrap -AutoSize | Out-Default $results = $NULL