0

I have a folder full of emails from my security camera, each one has attached images. I'd like to download all these files and then delete the emails but Outlook.com and the Windows Mail app don't seem to offer this functionality.

How can I download all the attachments from my Outlook.com folder?

1

I would suggest using PowerShell to automate this if you can install Outlook on the computer. For example, the following Powershell script could start you off:

Add-Type -assembly "Microsoft.Office.Interop.Outlook"

$Outlook = New-Object -ComObject Outlook.Application

foreach ($message in $Outlook.GetNameSpace("MAPI").pickfolder().Items) 
{
   write-host $message.Subject

   foreach ($att in $message.Attachments)
   {
       write-host "Attachment: " $att.filename
       if ($att.filename.Contains("backup")) 
       {
           $att.saveasfile( (Join-Path "C:\download\" $att.FileName ))
           # att.Delete()   # This will delete the attachment if uncommented
       }
   }
   # $message.Delete() # This will delete the email if uncommented
}

For each message in the chosen folder (Outlook will show a folder picker dialog), it will print the Subject of the message and for each attachment, when the filename contains "backup", will save the file to C:\downloads\

Hopefully, you might be able to adjust this to cope with your requirements. If you need to delete the attachments or the entire email, see the commented-out lines above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.