How to access body of Outlook email messages from Powershell script?
<p>I have a basic folder in my outlook with alerts from a monitoring system. I would like to create a table based upon that data. To that end I have been trying to access the body content of emails in Outlook:</p>

<pre><code>Add-Type -Assembly "Microsoft.Office.Interop.Outlook"
$Outlook = New-Object -ComObject Outlook.Application
$namespace = $Outlook.GetNameSpace("MAPI")
$inbox = $namespace.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderInbox)
$inbox.Items | Format-Table BodyFormat, Body, HTMLBody, RTFBody
</code></pre>

<p>Now I would expect to see some content for Body, HTMLBody, or RTFBody -- I do not. I DO see that BodyFormat is most often 2 (olFormatHTML). So most of the emails <em>should</em> have content in HTMLBody -- None of them do. I can access the subject lines but not the content. </p>

<p>Since every example I find online seems to be able to get the body content I think it must be a setting in outlook to only download the subject lines or something. We have Enterprise Vault -- could the content be stored separate from the message?</p>