Powershell EWS搜索过滤器NOT

时间:2017-05-10 06:24:45

标签: powershell exchangewebservices

我为使用EWS的解析电子邮件设计了一个非powerhell工具,但我想排除在Subject中具有特定内容的电子邮件。不幸的是我不知道如何构建NOT条件,例如:

New-Object Microsoft.Exchange.WebServices.Data.SearchFilter.Not+ConstainsSubstring([Microsoft.Exchange.WebServices.Data.EmailMessageSchema]::Subject, "Text To Match and Exclude")

有谁知道怎么做?

1 个答案:

答案 0 :(得分:1)

试试这个:

$SearchFilterContainsSubString = New-Object Microsoft.Exchange.WebServices.Data.SearchFilter+ContainsSubstring(
[Microsoft.Exchange.WebServices.Data.ItemSchema]::Subject, "Text To Match and Exclude")
$SearchFilterNot = New-Object Microsoft.Exchange.WebServices.Data.SearchFilter+Not($SearchFilterContainsSubString)