Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Outlook mac 2011 - Move to folder Shortcut Action (Automator Workflow)
(*
Original code from http://forgetmenotes.blogspot.com/2011/01/mac-outlook-2011-keyboard-shortcut-to.html
Adapted 2013 by Paul Porzky http://porzky.com
*)
on run {}
tell application "Microsoft Outlook"
-- listSelectedItems : a list of all items selected in Entourage
set listMessages to current messages
-- Check to make sure items are selected, if not then quit
if ((count of listMessages) < 1) then return
-- Iterate through selected items
repeat with objInSelection in listMessages
set listFolders to mail folders
repeat with objFolder in listFolders
if (name of objFolder is "follow-up") then
set gtdFolder to objFolder
end if
end repeat
if (class of account of objInSelection is not imap account) then
-- IMAP currently not supported
move objInSelection to gtdFolder
end if
end repeat
end tell
end run
@abraham09

This comment has been minimized.

Copy link

@abraham09 abraham09 commented May 19, 2014

I keep getting a "Syntax Error" when trying to compile: "Expected end of line, etc. but found identifier." Does for lines 11, 19 & 21. The script used to work, not sure why it won't anymore.

@papoms

This comment has been minimized.

Copy link
Owner Author

@papoms papoms commented Jul 2, 2014

i tried it again on 10.9.3 and it works just as expected. Are you sure you made no mistakes while copy and pasting?
Try downloading the script via http://porzky.com/wp-content/uploads/MovetoFollow-Up.scpt

@stomgb

This comment has been minimized.

Copy link

@stomgb stomgb commented Aug 27, 2014

Also got errors on the script above.

Here's a script that worked for me:

(*
 Original code from https://stackoverflow.com/questions/4413522/how-can-i-improve-this-applescript-macro-for-moving-emails-to-folders-in-office/25536769#25536769
*)


tell application "Microsoft Outlook"

    (* set account *)
    set thisAccount to exchange account "NAME_OF_OUTLOOK_ACCOUNT" -- e.g "Tom", "Work", "Your-Company-Name"
    set thisFolders to mail folder of thisAccount

    (*  find the particular folder I want to put all the messages in.
        the idea in this script is that you might want to move the emails to a subfolder of some root folder.
        in the example below, "Archived" is a subfolder of "Processed email". 
        if "Archived" is not a subfolder then just move the message to "thisRoot" directly (see comments inline)

     *)
    repeat with theFolder in thisFolders
        if name of theFolder is "Processed email" then  -- change name to "Archived" if "Archived" is not a sub folder
            set thisRoot to theFolder
        end if
    end repeat

    set destFolder to folder "Archived" of thisRoot  -- comment this line out if "Archived" is not a sub folder
    set currMsgs to current messages

    (* move all the messages *)

    repeat with theMessage in currMsgs
        move theMessage to destFolder  -- replace with line below if "Archived" is not a sub folder
        -- move theMessage to thisRoot  
    end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.