I am trying to create a Search Folder in Outlook-2010 representing all MailItems concerning a particular email address.
I.e. the MailItems where the email address is set as a SenderEmailAddress or a Sender or one of the Recipients or one of the ReplyRecipients.
As far as I know I can't do this using the Application.AdavancedSearch method and DASL filter because there's no access to Recipients or ReplyRecipients.
I tried to set the restriction using Redemption Searches object:
Set Store = RDSessoin.Stores.DefaultStore
Set Searches = Store.Searches
Set Folder = Store.IPMRootFolder
Addr = "123@example.com"'the email being searched
SQL = "(SenderEmailAddress LIKE '%"& Addr & "%') OR "& _
"(Recipients LIKE '%"& Addr & "%')"
Set NewSearch = Searches.AddCustom(Addr, strSQL, Folder)
It works but it doesn't include ReplyRecipients and Sender conditions.
When I try to add them to the restriction
SQL = "(SenderEmailAddress LIKE '%"& Addr & "%') OR "& _
"(Recipients LIKE '%"& Addr & "%') OR "& _
"(ReplyRecipients LIKE '%"& Addr & "%') OR "& _
"(Sender LIKE '%"& Addr & "%')"
the error "unknown property names" occurs.
What would the correct restriction syntax be and are there any other ways to create such a Search Folder?