如何使用 VBScript 在 Outlook 中搜索未读邮件? [英] How to search unread mail in Outlook with VBScript?

查看:89
本文介绍了如何使用 VBScript 在 Outlook 中搜索未读邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以打开 Outlook,将其聚焦到收件箱文件夹,并使用 .Unread 计算未读邮件.

I am able to open Outlook, focus it to the inbox folder, and count unread mails with .Unread.

我希望能够在电子邮件正文中搜索特定电子邮件地址的未读电子邮件.

I would like to be able to search unread email for a particular email address in the body of the emails.

我使用 Windows 7 和 Outlook 2007.

I am using Windows 7 with Outlook 2007.

推荐答案

您需要使用 限制查找/FindNext Items 类的方法.请查看以下文章以获取示例代码以及有关它们的更多信息:

You need to use the Restrict or Find/FindNext methods of the Items class. Take a look at the following articles for the sample code and more information about them:

例如,要查找文件夹中所有未读的电子邮件,您可以使用以下搜索条件:

For example, to find all unread emails in the folder you can use the following search criteria:

  [UnRead] = true

您可能还会发现 Application 类的 AdvancedSearch 方法很有帮助.在 Outlook 中使用 AdvancedSearch 方法的主要好处是:

Also you may find the AdvancedSearch method of the Application class helpful. The key benefits of using the AdvancedSearch method in Outlook are:

  • 搜索在另一个线程中执行.您不需要手动运行另一个线程,因为 AdvancedSearch 方法会在后台自动运行它.
  • 可以在任何位置搜索任何项目类型:邮件、约会、日历、笔记等,即超出某个文件夹的范围.Restrict 和 Find/FindNext 方法可以应用于特定的 Items 集合(请参阅 Outlook 中 Folder 类的 Items 属性).
  • 完全支持 DASL 查询(自定义属性也可用于搜索).您可以在 MSDN 的过滤文章中阅读有关此内容的更多信息.为了提高搜索性能,如果为商店启用了即时搜索,则可以使用即时搜索关键字(请参阅 Store 类的 IsInstantSearchEnabled 属性).
  • 最后,您可以随时使用 Search 类的 Stop 方法停止搜索过程.

Outlook 对象模型提供了三种处理项目正文的主要方式:

The Outlook object model provides three main ways for working with item bodies:

  • Body - 一个字符串,表示 Outlook 项目的明文正文.
  • HTMLBody - 表示指定项的 HTML 正文的字符串.
  • Word 编辑器 - 正在显示的消息的 Microsoft Word 文档对象模型.Inspector 类的 WordEditor 属性从 Word 对象模型返回 Document 类的一个实例,您可以使用它来设置消息正文.

您可以在 第 17 章:使用项目实体.选择自定义消息正文的方式由您决定.

You can read more about all these ways in the Chapter 17: Working with Item Bodies. It us up to you which way is to choose to customize the message body.

这篇关于如何使用 VBScript 在 Outlook 中搜索未读邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆