【问题标题】:Applescript for Outlook 2011 that moves all messages from a specific folder that match a source account to a different folderApplescript for Outlook 2011 将所有邮件从与源帐户匹配的特定文件夹移动到不同的文件夹
【发布时间】:2014-04-06 14:45:38
【问题描述】:

正如标题所述“使用 Applescript for Outlook 2011 将所有邮件从与源帐户匹配的特定文件夹移动到不同文件夹的帮助。”

所以,我有一个“规则”,可以将我的 Exchange 帐户上的所有新邮件移动到“我的电脑”子文件夹中的“收件箱”中。当我从这个子文件夹收件箱中删除项目时,它会进入我电脑上的“已删除项目”。我在与“收件箱”子文件夹相同的位置为“已删除项目”创建了一个子文件夹,我想按计划运行 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.

任何帮助表示赞赏!

【问题讨论】:

    标签: outlook applescript account


    【解决方案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
    

    【讨论】:

    • 使用 Mac Outlook v15 (2016) 我必须删除“在我的计算机上”才能使其正常工作。否则,工作真棒!谢谢@Cmstreeter。
    猜你喜欢
    • 2018-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    • 2022-08-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多