Submitted By: Kent Finkle

Retrieve email from the Outlook Inbox that was sent from a specified address

PowerShell
Edit|Remove
$comments = @'
Script name: Filter-ByAddress.ps1 
Created on: Wednesday, August 08, 2007 
Author: Kent Finkle 
Purpose: How can I use Windows Powershell to 
Filter Outlook Messages By Email Address? 
'@ 
 
$olFolderInbox = 6 
 
$o = new-object -comobject outlook.application 

$n = $o.GetNamespace("MAPI") 

$f = $n.GetDefaultFolder($olFolderInbox) 
 
$filter = "[SenderEmailAddress] = 'kenmyer@fabrikam.com'" 
 
$Items = $f.Items 

$Filtered = $Items.Restrict($filter) 
 
foreach ($m In $Filtered) { 
    Write-Host($m.Subject) 
}