Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Outlook Items.Restrict Does not return all messages
- [Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Outlook") | Out-Null
- $olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
- $outlook = new-object -comobject outlook.application
- $namespace = $outlook.GetNameSpace("MAPI")
- $inbox = $namespace.getDefaultFolder($olFolders::olFolderInbox)
- $filter = "[SenderName] = 'Dummy Sender'"
- $messages = $inbox.items.Restrict($filter)
- $messages | % {
- Write-Host "`t$($_.Subject)"
- [void]$_.Move($destination) | Out-Null
- }
Add Comment
Please, Sign In to add comment