Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

EWS - (401) Unauthorized

$
0
0

Hello, 

I have installed Exchange 2016 and 2019. I have a problem connecting to Powerwell to EWS. I run the script under the "Administrator" account. 

Import-Module-Name"C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"
$exchService =New-ObjectMicrosoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1)
$exchService.Url="https://mail.company.com/EWS/Exchange.asmx"
$exchService.UseDefaultCredentials= $true
$calendar =[Microsoft.Exchange.WebServices.Data.Folder]::Bind($exchService,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar)

The error message:

Exception calling "Bind"with"2" argument(s):"The request failed. The remote server returned an error: (401) Unauthorized."At line:6char:1+ $calendar =[Microsoft.Exchange.WebServices.Data.Folder]::Bind($exchS ...+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+CategoryInfo:NotSpecified:(:)[],ParentContainsErrorRecordException+FullyQualifiedErrorId:ServiceRequestException

Maybe a problem here: "([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1)."  ..?
The set EWS: "Authentication: Basic, NTLM, Integrated Windows, Windows SharePoint Security, OAuth"

Can you help me ..?

Thank you Michal.


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>