Reputation: 33
I need to parse the body of emails to get the contents of a table out of each email. I would like to use PowerShell to do this. I have tried this code:
Get-ChildItem "C:\Users\mmartindale.NTSERVER\Desktop\delreg temp\msg" -Filter *.msg |
ForEach-Object {
$outlook = New-Object -comobject outlook.application
$msg = $outlook.Session.OpenSharedItem($_.FullName)
$msg | Select body | ft -AutoSize
}
But all I get is an abbreviated output like this:
Body ---- This is approved for Deal Reg...
How do I output this as an object that I can loop through?
Upvotes: 3
Views: 9655
Reputation: 13176
You can use Select-Object
's -ExpandProperty
parameter to expand the property you want.
As in:
$msg | Select-Object -ExpandProperty Body
Upvotes: 2