thought i would share this.
A need came up where we needed to export email attachemtns of a given folder to local HD folder.
here is the end result.
Code:
$folder = OutlookGetFolder("Mailbox - Bryce Lindsay\Inbox\TSI Stuff\WorkOrders")
OutlookSaveAttachemnts($folder,"c:\WorkOrders")
Function OutlookSaveAttachemnts($folder,$SavePath)
for each $message in $folder.items
$Att = $message.Attachments
if $att.count > 0
for $i = 1 to $Att.count
$att.item($i).saveasfile($Savepath + "\" + $att.item($i).Filename)
next
endif
next
exit @error
endfunction
Function OutLookGetFolder($path)
DIM $path, $MYOLApp, $MYNameSpace, $folder
$path = split($path,"\")
$myOlApp = CreateObject("Outlook.Application")
$myNameSpace = $myOlApp.GetNameSpace("MAPI")
$Folder = $myNameSpace.Folders($path[0])
? @error
if not @error
for $i = 1 to ubound($path)
$folder = $folder.folders($path[$i])
next
if @error
exit @error
endif
else
exit @error
endif
$OutlookgetFolder = $folder
endfunction