With the recent release of the RC for the EWS Managed API there was one change that affected a lot of the scripts i've posted on this blog. While i will update them all in time if you have created any scripts of your own based on these you will need to look at making the following changes to allows your scripts to function correctly when you update to the RC of the Managed API.
The change was
$Sf = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.EmailMessageSchema]::IsRead, $false)
$view = New-Object Microsoft.Exchange.WebServices.Data.ItemView(1)
$findResults = $service.FindItems([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$Sf,$view)
or if your binding to the folder directly eg
$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox)
$findResults = $inbox.Finditems($sf,$view)
The change was
- In a FindItems call, the search filter now has to be passed as a parameter to FindItems, as opposed to being a property of ItemView
$Sf = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.EmailMessageSchema]::IsRead, $false)
$view = New-Object Microsoft.Exchange.WebServices.Data.ItemView(1)
$findResults = $service.FindItems([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$Sf,$view)
or if your binding to the folder directly eg
$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox)
$findResults = $inbox.Finditems($sf,$view)