MVP Systems - Support
Home
Search All
Go
Advanced Search
Search
Tags
Glossary
Welcome Guest
(
Login
|
Register
)
Latest Additions
Most Popular
Knowledgebase
Downloads
Documentation
Submit Ticket
Home
»
Knowledgebase
»
JAMS
»
Automating Outlook Tasks
Automating Outlook Tasks
Automating Outlook Tasks
JAMS has the ability to automate Outlook tasks such as saving attachments or exporting email information.
While Outlook profile settings and Exchange security settings can complicate these tasks, Outlook provides COM objects for automation within Powershell.
The following examples parse the Test folder within the Outlook Inbox.
Example #1. Exporting the Sender email addresses from an Outlook folder:
$olFolderInbox = 6
$ol = new-object -comobject "Outlook.Application"
$mapi = $ol.getnamespace("mapi")
$inbox = $mapi.GetDefaultFolder($olFolderInbox)
$msgs = $inbox.Folders.Item("Test")
$msgs.items | Select-Object SenderName, SenderEmailAddress -unique | export-Csv c:\emails.csv -noTypeInformation
Example #2. Saving the email attachments from an Outlook folder:
$olFolderInbox = 6
$ol = new-object -comobject "Outlook.Application"
$mapi = $ol.getnamespace("mapi")
$inbox = $mapi.GetDefaultFolder($olFolderInbox)
$msgs = $inbox.Folders.Item("Test")
foreach ($group in $msgs.items |% {$_.attachments} | group filename)
{
trap {
Write-Host There was a problem saving $fName
continue
}
$fName = "C:\TEMP\$($group.Name)"
$group.Group[0].saveasfile($fName)
if ($?) {Write-Host $fName was saved succesfuly.}
}
Rate this Article:
Add Your Comments
Name:
*
Email Address:
Web Address:
Verification Code:
*
Details
Last Modified:
Wednesday, September 22, 2010
Last Modified By:
DanielS
Type:
HOWTO
Rated 5 stars based on 1 vote
Article has been viewed 726 times.
Options
Send by email...
Email Article
Print Article
Bookmark Article
Social Bookmarks...
Social Bookmarks
Comments RSS
Export As PDF
Powered By InstantKB.NET 2011 © 2012
Execution: 0.170.
10 queries.
Compression Disabled.