Author Posts

August 10, 2015 at 4:21 am

I have a report that comes with a particular subject via email to my mailbox. I need to write a script that will pull out the attachments and then put those files in a folder on the system so that other scripts can pick it up and use the files. My exchange version is 2007. I am very new to PowerShell scripting. Please help.

August 10, 2015 at 4:36 am

Exchange doesn't really offer a means of doing that server side. You could potentially script against the Outlook COM object on your client, but that does get pretty complex pretty quickly.

August 10, 2015 at 5:08 am

I am using the Outlook com object
You can try something like this:

$GetMailItems = @(
    $OutlookInbox = 6
    $Outlook = New-Object -Com Outlook.Application;
    $NameSpace = $Outlook.GetNameSpace("MAPI");
    $Inbox = $NameSpace.GetDefaultFolder($OutlookInbox))
 
       $Inbox.Items | ForEach {
        If ($_.Subject -eq "subject goes here")
        {
        Put your code to save to folder
        }}
       

Like Don said it does get complex