Since I have installed the CU1 to the Exchange 2013 I get an Internal Server Error with the Managed Exchange API 2.0 if i try to use the SyncFolderItems function against a public folder.
I know, this was working with exact the same code before I have installed the CU1.
The problem comes up only if I have more than 6 items in the folder. I have tested with a contact and mailfolder. We can see the problem also on one of my customers Exchange Servers, he has also the CU1.
See this code to reproduce the error (Exchange "2" with a really existing public folder ):
The code will run trough all public Exchange folders and if it finds a folder named "2" it will use the function SyncFolderItems against that folder, the code is not sencefull but it will show the error if you have more then 6 items in it.
Import-Module -Name "C:\Program Files (x86)\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll" $ews = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService -ArgumentList "Exchange2013" $cred = (Get-Credential).GetNetworkCredential() function EnumFolders($folderidcnt) { $fiResult = $ews.FindFolders($folderidcnt,$null,$fvFolderView) foreach($ffFolder in $fiResult.Folders) { if($ffFolder.DisplayName -eq "2") {"Found:"+$ffFolder.DisplayName"ID:"+$ffFolder.Id $changes = $ews.SyncFolderItems($ffFolder.Id,[Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties,$null,512,[Microsoft.Exchange.WebServices.Data.SyncFolderItemsScope]::NormalItems,"")"Changes In Folder:" + $changes.Count foreach($change in $changes) {"-"+$change.Item.Subject } }"- Folder:"+ $ffFolder.DisplayName; EnumFolders($ffFolder.Id); } } $ews.Credentials = New-Object System.Net.NetworkCredential -ArgumentList $cred.UserName, $cred.Password, $cred.Domain $ews.Url= "https://srv2012/EWS/Exchange.asmx" $folderidcnt = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::PublicFoldersRoot,$null) $fvFolderView = New-Object Microsoft.Exchange.WebServices.Data.FolderView(1000) $psPropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties) $fvFolderView.PropertySet = $psPropertySet; $fiResult = $null do { EnumFolders($folderidcnt); }while($fiResult.MoreAvailable -eq $true)
I have activated the tracelog in IIS. Here is some output from it.