问题
I'm having a fair bit of trouble trying to search for some messages using Search-Mailbox
.
Search-Mailbox -Identity $User `
-SearchQuery "Attachment:p* AND From:$email AND To:reception@contoso.com AND Received<`"04/02/2018`" AND Subject:(GfC* OR G4C* OR c4g* OR GfC OR G4C OR c4g)" `
-LogOnly -TargetMailbox "myusername" -TargetFolder "SearchAndDeleteLog" -LogLevel Full
However I'm getting matches to messages which don't match the SearchQuery criteria, in particular the Subject:(...).
For example, one email the matched the From and To but didn't have an attachment and had a Subject "RE: RE:"
Is there something I am missing in the KQL as it seems to me I might be getting OR
behaviour instead of AND
.
来源:https://stackoverflow.com/questions/50452276/search-mailbox-searchquery-trouble-with-and-and-or