Hello,
I can't figure out why this piece of code suddenly stopped working.
Add-Type -Path "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"
$mailboxName = "user@domain.com"
$Exchange2010SP2 = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP2
$exchangeService = New-Object -TypeName Microsoft.Exchange.WebServices.Data.ExchangeService -ArgumentList $Exchange2010SP2
$exchangeService.UseDefaultCredentials = $true
$exchangeService.AutodiscoverUrl($mailboxName)
$inboxFolderName = [Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox
$inboxFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($exchangeService,$inboxFolderName)
The error message is
Exception calling "Bind" with "2" argument(s): "The request failed. The remote server returned an error: (504) GatewayTimeout."
At E:\scripts\var\test.ps1:8 char:67
+ $inboxFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind <<<< ($exchangeService,$inboxFolderName)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
when I retrieve list of subfolders without binding, it works fine. How can I fix this problem, or how can I get items without binding?
$exchService.Timeout = 100000000doesn't help
Thank you