Submitted By: Kent Finkle

List email messages from the Outlook Inbox with specified text in the Subject line.

PowerShell
Edit|Remove
$comments = @'
Script name: Filter-Subject.ps1 
Created on: Tuesday, August 14, 2007 
Author: Kent Finkle 
Purpose: How can I use Windows Powershell to 
Filtering Email Messages in Microsoft Outlook? 
'@ 
 
$olFolderInbox = 6 
$o = new-object -comobject outlook.application 
$n = $o.GetNamespace("MAPI") 

$f = $n.GetDefaultFolder($olFolderInbox) 
 
$items = $f.Items 

$filtered = $items.Restrict("[Subject] = 'Project Proposal'") 
 
foreach ($item In $filtered) { 
    Write-Host($item.Body) 
}