asked on
Public Sub scanFolder()
Dim src As Folder
Dim oItem As Object
Dim propertyAccessor As Outlook.propertyAccessor
Set src = Application.ActiveExplorer.CurrentFolder
Dim strHeader As String
For Each oItem In src.Items
If TypeOf oItem Is Outlook.MailItem And oItem.Categories <> "" Then
' Debug.Print "Cat: " + oItem.Categories
Set propertyAccessor = oItem.propertyAccessor
header = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E")
Dim headerLines() As String
headerLines() = Split(header, vbCrLf)
Dim thisHeader As Variant
For Each thisHeader In headerLines
If InStr(thisHeader, "Message-ID:") > 0 Then
Debug.Print thisHeader + "~" + oItem.Categories
Exit For
End If
Next
End If
Next
End Sub