Mit Powershell Outlook Attachments abspeichern

Ich bin heute durch intensives Googeln auf eine elegante Art gestoßen, Outlook Attachments in einem Rutsch abzuspeichern.

# Kiron, March 12 2009 in microsoft.public.windows.powershell
$outlook = new-object -com Outlook.Application
$inbox = $outlook.Session.GetDefaultFolder(6)
foreach ($group in $inbox.items |% {$_.attachments} | group filename) {
   trap {
   Write-Host There was a problem saving $fName
   continue
}
 
$fName = "C:\TEMP\emails\$($group.Name)"
$group.Group[0].saveasfile($fName)
if ($?) {
   Write-Host $fName was saved succesfully.
 }
}

Echt praktisch, mit 10 Zeilen Skripting solche Funktionalität…

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website