【发布时间】:2016-01-25 14:03:03
【问题描述】:
以下代码从 Outlook 中获取所有未分类的项目,但它返回所有项目,包括约会和会议。我需要一个代码,它只返回未分类的消息。
Sub NullCategoryRestriction()
Dim oFolder As Outlook.Folder
Dim oItems As Outlook.Items
Dim Filter As String
'DASL Filter can test for null property.
'This will return all items that have no category.
Filter = "@SQL=" & Chr(34) & _
"urn:schemas-microsoft-com:office:office#Keywords" & _
Chr(34) & " is null"
Set oFolder = Application.ActiveExplorer.CurrentFolder
Set oItems = oFolder.Items.Restrict(Filter)
Debug.Print oItems.Count
End Sub
【问题讨论】: