Ews登录验证的最佳方式

时间:2017-07-31 11:41:17

标签: c# exchangewebservices

是否遵循对任何交换版本有效的代码来验证用户凭据?

ExchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP1, TimeZoneInfo.Utc);
                ExchangeService.Credentials = new WebCredentials(mailAddress, password);

                ExchangeService.Url =  AppGlobal.EwsAddress;   
var findFolderResults = ExchangeService.FindFolders(WellKnownFolderName.Root, new SearchFilter.IsGreaterThan(FolderSchema.TotalCount, 0), new FolderView(10));

1 个答案:

答案 0 :(得分:1)

因为您正在使用

ExchangeVersion.Exchange2010_SP1

它适用于任何Exchange 2010 SP1或更高版本的Exchange服务器。如果服务器是Exchange 2007或Exchange 2010 RTM,则由于请求的服务器版本,您将收到错误。