Exchange Web Services, try to use ExchangeImpersonationType ...

Posted by howmanytimes on Stack Overflow See other posts from Stack Overflow or by howmanytimes
Published on 2008-10-15T20:34:35Z Indexed on 2010/03/21 0:51 UTC
Read the original article Hit count: 693

I am trying to use EWS, first time trying to use the ExchangeServiceBinding. The code I am using is below:

_service = new ExchangeServiceBinding();
//_service.Credentials = new NetworkCredential(userName, userPassword, this.Domain);
_service.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
_service.Url = this.ServiceURL;

ExchangeImpersonationType ei = new ExchangeImpersonationType();
ConnectingSIDType sid = new ConnectingSIDType();
sid.PrimarySmtpAddress = this.ExchangeAccount;
ei.ConnectingSID = sid;            
_service.ExchangeImpersonation = ei;

The application is an aspnet 3.5 trying to create a task using EWS. I have tried to use impersonation because I will not know the logon user's domain password, so I thought impersonation would be the best fit. Any thoughts on how I can utilize impersonation? Am I setting this correctly, I get an error while trying to run my application. I also tried without impersonation just to try to see if I can create a task, no luck either. Any help would be appreciated. Thanks.

© Stack Overflow or respective owner

Related posts about exchange

Related posts about web-services