Tag: exchangewebservices

Exchange Web Service API和401未经授权的例外

当我尝试使用EWS API发送电子邮件时,我收到以下错误:(在message.Send(); ) 请求失败。 远程服务器返回错误:(401)未经授权。 我的代码如下: ExchangeService exchangeService = new ExchangeService(ExchangeVersion.Exchange2007_SP1); //WebService Uri try { exchangeService.Url = new Uri(“https://exchangeserver/ews/exchange.asmx”); } catch (Exception ex) { throw new Exception(string.Format(“WebService Uri:” + ex)); } //Credentials try { exchangeService.Credentials = new WebCredentials(“user@domain”, “pwd”, “domain”); } catch (Exception ex) { throw new Exception(string.Format(“Credentials:” + ex)); } //Send a mail try […]