Hi,
I'm trying to read the Contacts in a Mailbox using EWS and PowerShell.
The Mailbox of the User which I use to authenticate is on Exchange 2007.
The Mailbox which I try to read is on Exchange 2013 SP1.
Add-Type -AssemblyName System.Web Add-Type -Path "F:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll" $Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials("*****","*******","*****") $ExchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1 $exchService = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService($ExchangeVersion) $exchService.Credentials = $Credentials $Mailbox = xxxxx@xxxxx.xx $exchService.AutodiscoverUrl($Mailbox) $folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Contacts,$Mailbox) $Contacts = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($exchService,$folderid) $ivItemView = New-Object Microsoft.Exchange.WebServices.Data.ItemView(50) $fiItems = $exchService.FindItems($Contacts.Id,$ivItemView)
And the Error:
Exception calling "FindItems" with "2" argument(s): "The Client Access server version doesn't match the Mailbox server
version of the resource that was being accessed. To determine the correct URL to use to access the resource, use
Autodiscover with the address of the resource."
At J:\data\ews.ps1:130 char:21
+ $fiItems = $exchService.FindItems($Contacts.Id,$ivItemView)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ServiceResponseException
Any ideas?
Must be the who Mailboxes on the same Exchange-Version?