当前位置: 代码迷 >> Exchange >> EWS联接Exchange2007无法模拟用户
  详细解决方案

EWS联接Exchange2007无法模拟用户

热度:3937   发布时间:2013-02-26 00:00:00.0
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));


解决方法:

在PowerShell中执行以下命令:


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}


1 楼 andnnl 2011-11-07  
无语。。。在chrome下,不能提交。。。又重写了一次,
在可视化模式修改,代码成了文本(少了代码框)
2 楼 andnnl 2011-11-07  
参考资料:

http://blogs.msdn.com/b/brijs/archive/2010/03/09/how-to-configure-and-use-ews-impersonation-on-exchange-2010-2007.aspx

http://msdn.microsoft.com/en-us/library/bb204095(EXCHG.80).aspx