Outlook AddOn 如何获取选定的电子邮件?

发布于 2024-08-25 11:57:43 字数 151 浏览 3 评论 0原文

我正在制作一个 Outlook 插件,我正在尝试找到一种方法来查看选择了哪些电子邮件,然后能够通过 foreach (或其他方式)使用它们。如果这是不可能的,是否有一种方法可以获取文件夹中的所有项目并轻松访问该信息?之后我需要将这些项目移动到另一个文件夹。

我该怎么做呢?

I'm making an outlook addon and I'm trying to find a way to see which emails are selected, then be able to work with them through a foreach (or whatever). If this is not possible, is there a way to fetch all items in a folder and get access to that information easily? After that I need to move those items to another folder.

How would I go about doing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

各自安好 2024-09-01 11:57:43

您可以使用 Application.ActiveExplorer 方法获取当前活动的资源管理器窗口(=显示邮件列表的东西)。然后您可以使用 Explorer.Selection 属性来获取所选列表电子邮件。

要移动邮件,请使用 MailItem.Move 方法。

You can use the Application.ActiveExplorer method to get the currently active Explorer window (= the thing that displays the list of mails). Then you can use the Explorer.Selection property to obtain the list of selected e-mails.

To move the mails, use the MailItem.Move method.

玉环 2024-09-01 11:57:43

附件是我从 Outlook 消息中获取所选电子邮件的代码。
对于olitem,请根据需要随意修改。

Sub ReplyMSG()
    Dim olItem As Outlook.MailItem
    Dim olReply As MailItem  ' Reply
    For Each olItem In Application.ActiveExplorer.Selection
        Set olReply = olItem.ReplyAll
        olReply.HTMLBody = "Reminder" & vbCrLf & olReply.HTMLBody
        olReply.Display
        'olReply.Send
    Next olItem
End Sub

Attached is my code to get the selected email from outlook messages.
For the olitem feel free to modify as you need.

Sub ReplyMSG()
    Dim olItem As Outlook.MailItem
    Dim olReply As MailItem  ' Reply
    For Each olItem In Application.ActiveExplorer.Selection
        Set olReply = olItem.ReplyAll
        olReply.HTMLBody = "Reminder" & vbCrLf & olReply.HTMLBody
        olReply.Display
        'olReply.Send
    Next olItem
End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文