July 2017
Intermediate to advanced
648 pages
31h 9m
English
If you want to use explicit credentials when creating your ExchangeService object rather than using the credentials of the currently logged on user, you need to do a couple of things differently. The following code will create an instance of the ExchangeService class using an alternate set of credentials:
[System.Reflection.Assembly]::LoadFile( "C:\ews\Microsoft.Exchange.WebServices.dll" ) $svc = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService $svc.Credentials = New-Object ` Microsoft.Exchange.WebServices.Data.WebCredentials ` -ArgumentList "jonand","P@ssw0rd01","testlabs.se"
In addition, you also have the option of setting the EWS URL manually:
$url = "https://autodiscover.testlabs.se/EWS/Exchange.asmx" ...Read now
Unlock full access