在 ActiveExplorer 中显示或显示项目集合或搜索对象

Show or display items collection or search object in ActiveExplorer

我可以通过 Items.Restrict 将项目集合捕获到变量或通过 AdvancedSearch 将搜索对象捕获到变量...如何在 ActiveExplorer 中显示项目或搜索?

其中 objSearch 是一个搜索对象

Set objSearch = objOL.AdvancedSearch(strScope, strSearch, True, "PracticeSearch")

或者 rtrndItems 是一个项目对象

Set rtrndItems = myItems.Restrict(strSearch)

感谢您的帮助!!

所有这些方法都设计为 运行 以编程方式进行,没有任何 UI 反馈。最好的办法是将 AdvancedSearch 结果保存到 Outlook 中的搜索文件夹中。 Search.Save 方法将搜索结果保存到 Search 文件夹。例如:

Public blnSearchComp As Boolean 
 
Private Sub Application_AdvancedSearchComplete(ByVal SearchObject As Search) 
 MsgBox "The AdvancedSearchComplete Event fired"
 blnSearchComp = True 
End Sub 
 
Sub TestAdvancedSearchComplete() 
 Dim sch As Outlook.Search 
 Dim rsts As Outlook.Results 
 Dim i As Integer 
 blnSearchComp = False 
 Const strF As String = "urn:schemas:mailheader:subject = 'Test'" 
 Const strS As String = "Inbox" 
 Set sch = Application.AdvancedSearch(strS, strF)
 While blnSearchComp = False 
   DoEvents
 Wend 
 
 sch.Save("Subject Test") 
 
End Sub

要在 Outlook 中搜索包含任何 UI 反馈的项目,您需要使用 Explorer.Search 方法,该方法使用给定的查询[=] 对资源管理器中显示的当前文件夹执行 Microsoft 即时搜索18=]

这是 MSDN 对 Search 方法的说明:

The functionality of Explorer.Search is analogous to the Search button in Instant Search. It behaves as if the user has typed the query string in the Instant Search user interface and then clicked Search. When calling Search, the query is run in the user interface, and there is no programmatic mechanism to obtain the search results. For more information on Instant Search, query for "Instant Search" in the Outlook Help.

Search 方法不提供使开发人员能够确定搜索何时完成的回调。