1

As the Title states "Help with an Applescript for Outlook 2011 that moves all messages from a specific folder that match a source account to a different folder."

So, I have a "rule" that moves all new mail on my exchange account into a "Inbox" in a subfolder On My Computer. When I delete items form this subfolder inbox it goes into the "Deleted Items" On My Computer. I have made a sub-folder for "Deleted Items" in the same place as my "Inbox" sub-folder and I would like to run an Applescript on a schedule that can go into the main Deleted Items On My Computer and find the messages from that exchange account and move them into "subfolder/Deleted Items".

Googling about I cobbled the below together which will move ALL mail in Deleted Items:

tell application "Microsoft Outlook"
set topFolder to mail folder "AT&T" of on my computer
set destFolder to folder "Deleted Items" of topFolder
move every message of mail folder "Deleted Items" of on my computer to destFolder
end tell

The part I can't get past is now only selectively moving mail whose "account" is a specific value, like thus:

tell application "Microsoft Outlook"
set topFolder to mail folder "AT&T" of on my computer
set destFolder to folder "Deleted Items" of topFolder
move (every message of mail folder "Deleted Items" of on my computer whose account = "Att") to destFolder
end tell

Any help appreciated!!

1
tell application "Microsoft Outlook"
    set topFolder to mail folder "AT&T" of on my computer
    set destFolder to folder "Deleted Items" of topFolder
    set srcFolder to mail folder "Deleted Items" of on my computer
    set selectedMessages to messages of srcFolder
    repeat with theMessages in selectedMessages
        set thisAccount to account of theMessages
        if (name of thisAccount as text is "Att") then
            if (is read of theMessages is false) then
                set theMessages's is read to true
            end if
            move theMessages to destFolder
        end if
    end repeat
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .