EWS connect to ExchangeServer authentication specifications
Posted
by dankyy1
on Server Fault
See other posts from Server Fault
or by dankyy1
Published on 2010-02-24T12:04:05Z
Indexed on
2010/03/29
10:53 UTC
Read the original article
Hit count: 642
exchange
|authentication
Hi all I'm connecting to ExchangeServer with username,password,doain properities(my code below) but what how to define server uses Kerberos,ntlm or basic authentication e.g? thnx
xchangeServiceBinding binding = new ExchangeServiceBinding();
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
System.Net.WebProxy proxyObject = new System.Net.WebProxy();
proxyObject.Credentials = System.Net.CredentialCache.DefaultCredentials;
if (string.IsNullOrEmpty(credentials.UserName) || string.IsNullOrEmpty(credentials.Password) || string.IsNullOrEmpty(credentials.Domain))
throw new ArgumentNullException("The Crediantial values could not be null or empty.");
binding.Credentials = new NetworkCredential(credentials.UserName, credentials.Password, credentials.Domain);
if (string.IsNullOrEmpty(serverURL))
throw new ArgumentNullException("The Exchange server Url could not be null or empty.");
binding.Url = serverURL;
binding.UseDefaultCredentials = true;
binding.Proxy = proxyObject;
//TO DO:take version over parameter..or configration!!
binding.RequestServerVersionValue = new RequestServerVersion();
binding.RequestServerVersionValue.Version = (ExchangeVersionType)Enum.Parse(typeof(ExchangeVersionType), serverVersion);// ExchangeVersionType.Exchange2007_SP1;//.Exchange2010;
© Server Fault or respective owner