EWS连接Exchange2007无法模拟用户
错误提示:由于权限不足,与应用程序连接的服务器无法模拟所请求的用户
这行出错: service.ImpersonatedUserId ....
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);service.Credentials = new WebCredentials("administrator", "asdf-123", "ex.asdf.cn");service.Url = new Uri("https://asdf-exchange.ex.asdf.cn/ews/exchange.asmx");service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "testmbx@ex.asdf.cn");findResults = service.FindItems(WellKnownFolderName.Contacts, new ItemView(int.MaxValue));
Get-ExchangeServer | where {$_.IsClientAccessServer -eq $TRUE} | ForEach-Object {Add-ADPermission -Identity $_.distinguishedname -User (Get-User -Identity administrator | select-object).identity -extendedRight ms-Exch-EPI-Impersonation}