Tuesday, November 2, 2010

Automating Outlook 2011 with Applescript

I am continuing my automation work with folder actions and applescript and had a desire to be able to email from the new Mac Office 2011 using Outlook. There are several examples for how to do it with Entourage but the syntax has changed regarding mail to recipients. Without further delay, here is a working script:

tell application "Microsoft Outlook"
 set newMessage to make new outgoing message with properties {subject:"Hooray for automation"}
 make new recipient at newMessage with properties {email address:{name:"Jim Shank", address:"jim.shank@example.com"}}
 open newMessage
end tell

After hours of searching, I finally came across this fantastic example from Bobby Kansara at Microsoft. Thanks to the early adopters and beta testers.