vbaoutlookadvanced-search

Advanced Search in all subfolders but not in main folder


I use this "Scope" for an advanced search:

Scope = "'" & Application.Session.GetDefaultFolder  (olFolderInbox).FullFolderPath & "'" ','" & Application.Session.GetDefaultFolder(olFolderSentMail).FullFolderPath & "'"
Filter = "urn:schemas:mailheader:subject = '" & MSG.ConversationTopic & "'"
Set olSuche = Application.AdvancedSearch(Scope, Filter, True, "MySearch")

But instead of searching through the complete inbox and all of its subfolders I would like to search only through the subfolders and exclude the inbox as such.

Thanks for any good idea.

Ralf


Solution

  • Try to add a condition on PR_PARENT_ENTRYID <> entry id of the Inbox folder. PR_PARENT_ENTRYID property DASL name is http://schemas.microsoft.com/mapi/proptag/0x0E090102