适用于 Outlook 2011 的 Applescript 可将与源帐户匹配的特定文件夹中的所有邮件移动到其他文件夹



正如标题所述"有关 Outlook 2011 Applescript 的帮助,该脚本将所有邮件从与源帐户匹配的特定文件夹移动到其他文件夹。

因此,我有一个"规则",可以将我的交换帐户上的所有新邮件移动到"我的电脑上"子文件夹中的"收件箱"中。当我从此子文件夹收件箱中删除项目时,它会进入"我的计算机上的已删除项目"。我已经在与"收件箱"子文件夹相同的位置为"已删除邮件"创建了一个子文件夹,我想按计划运行Applescript,该脚本可以进入"我的计算机上的主已删除邮件",并从该交换帐户中找到邮件并将它们移动到"子文件夹/已删除邮件"中。

谷歌搜索我拼凑了以下内容,这将移动已删除邮件中的所有邮件:

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

我无法过去的部分现在只是有选择地移动其"帐户"为特定值的邮件,如下所示:

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

尝试按帐户过滤的最后一次添加引发了错误

Microsoft Outlook got an error: Can’t make account into type specifier.

任何帮助感谢!!

设计了一个有效的解决方案。而不是一行,选择文件夹中的所有邮件并循环浏览它们,将帐户名称作为文本抓取并进行比较和移动。

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

最新更新