I am trying to retrieve data from an Inbox subfolder and I am having a brain block.
Can someone please help me with this?
The folder is just one level below my Outlook Inbox and I need to parse information from the email items in this subfolder. Basically, the subfolder’s name is “Microsoft Project and Visio Installs Inventory Notices” and I would like to have a script that can read each mail item and output the info like this:
XX number of Visio Pro Installs
XX number of Visio Standard Installs
XX number of Project Pro Installs
XX number of Project Standard Installs
For some reason I just cannot get my head wrapped around it.
This is what I have so far, but I am needing to tweak this a bit to get the results I desire, such as setting it to read from the “Microsoft Project and Visio Installs Inventory Notices” subfolder.
$GetMailItems = @(
$OutlookInbox = 6
$Outlook = New-Object -Com Outlook.Application;
$NameSpace = $Outlook.GetNameSpace("MAPI");
$Inbox = $NameSpace.GetDefaultFolder($OutlookInbox)
$Inbox.Items | ForEach {
If ($_.Body -match "Project|Visio" -and $_.Body -notmatch "MUI|Service Pack|Update|Viewer|Vision")
{
Write-Output $_.Body
}})
$GetMailItems
Thanks