mikebmassey
mikebmassey

Reputation: 8584

MS Outlook script runs, but no messages move

I'm trying to write an applescript that I can automate to clean up my mailbox on a schedule. Here is the code:

tell application "Microsoft Outlook"
    set srcFolder to mail folder "Inbox" of on my computer
    set destFolder to mail folder "Deleted Items" of on my computer
    set selectedMessages to messages of srcFolder
    repeat with theMessages in selectedMessages
        if (sender of theMessages is "[email protected]") then
            move theMessages to destFolder
        end if
    end repeat
end tell

The code is going to search for the email address, then move those messages to the Deleted Items folder.

The script runs, but no messages run. Can anyone see why this wouldn't run correctly?

Upvotes: 0

Views: 45

Answers (1)

Craig Smith
Craig Smith

Reputation: 1071

Have you tried deleting both occurrences of

of on my computer

It may not be necessary, and might be messing up the script.

You might also try changing this line:

set selectedMessages to messages of srcFolder

to

set selectedMessages to every message of srcFolder

I do not have Outlook on my machine, so I cannot test these.

Upvotes: 1

Related Questions