Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scripting Office Outlook 2016 on Mac [closed]

I'd like to automate Outlook 2016 on Mac.

The task I'd like to automate is basically the following:

  • search inbox for mails from the previous week having a specific pattern in the title
  • prepare a new mail which content is the consolidated content of all the mails found in the previous step
  • let the mail open (or in draft) to let me edit it before to send it

Well, I just don't know how to handle it...

  • Visual Basic (my preferred option) seems not to be present at all in Outlook 2016 on Mac!! I can't even find the VB editor (while I do find it for e.g. excel).
  • AppleScript might allow to do that. But I just do not find any documentation on the outlook API. Plus, it seems to only allow very basic automation.
  • Automator?

Note that I have access to a windows machine. So, it is possible (though painful) for me to write a VBA script there and "transfer it" to the Mac. I do not have Office 365.

Thanks for your help!

Sylvain

like image 927
Sylvain Avatar asked Feb 13 '16 22:02

Sylvain


People also ask

Does Outlook allow scripting by default?

Office Scripts is turned on by default, and everyone in your organization can access and use the feature and share scripts.

How do I open VBA in Outlook for Mac?

Showing the Developer tab in MAC OSXOpen the relevant Microsoft Office application, be it Word, PowerPoint or Excel. Now you'll have couple options: Hit Macros… in order to access your presentation/workbook or document macros. Hit Development, to access the VBA editor.


1 Answers

This is very possible with AppleScript. Here's an example with the basics:

tell application "Microsoft Outlook"

    set theContent to ""
    set theMessages to messages of folder "Inbox" of default account
    repeat with theMessage in theMessages
        if subject of theMessage contains "match this string" then
            set theContent to theContent & plain text content of theMessage
        end if
    end repeat

    set theMessage to make new outgoing message with properties {subject:"the subject line", plain text content:theContent}
    make new recipient with properties {email address:{address:"[email protected]", name:"Lumpkin Skinbark"}} at end of to recipients of theMessage
    open theMessage -- for further editing

end tell

If you haven't found it yet, you can open Outlook's script dictionary by choosing "Open Dictionary" from the File menu and selecting the Microsoft Outlook application.

like image 181
Steve Poole Avatar answered Oct 12 '22 02:10

Steve Poole