EWS:模拟来自一个域中不同服务器的用户

发布于 2024-11-15 21:42:45 字数 771 浏览 3 评论 0原文

我有两台服务器: S1是Exchange2010 S2 是 Exchange 2007

两台服务器位于 ActiveDirectory 中的同一域中。

想法是在 S1 上拥有“服务帐户”,并启用来自两台服务器的用户模拟。我的应用程序使用“服务帐户”的凭据,然后开始迭代 smtp 地址列表。它模拟每个 smtp 地址并对该帐户的邮箱内容进行一些处理。

这是一个理论,现在是解决问题的时候了。

我可以作为服务帐户进行连接并可以访问其邮箱,但是当我尝试访问模拟用户的邮箱时,我收到异常消息“SMTP 地址没有与之关联的邮箱”。两台服务器都会发生异常。

我开始调试和谷歌搜索可能的原因,无缘无故地我把这个:改成

svc.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, smtpAddress);

了这个:

svc.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.PrincipalName, smtpAddress);

它起作用了,这很奇怪,因为一个月前我只在一台服务器上进行了不同的设置,并且使用 SmtpAddress 枚举起作用了,我的管理员发誓该配置冒充是完全一样的。

现在,如果有人可以向我提供一些提示,说明为什么我不能使用 ConnectingIdType.SmtpAddress 以及我应该做什么才能使其正常工作?

I have two servers:
S1 is Exchange2010
S2 is Exchange 2007

Both servers are in the same domain in ActiveDirectory.

Idea is to have "service account" on S1 with enabled impersonation of users from both servers. My app is using credentials of "service account" and then starts to iterate through a list of smtp addresses. It impersonates each smtp address and does some processing on content of mailbox of that account.

That is a theory, now time for problems.

I can connect as a service account and can access its mailbox but when I try to access mailbox of impersonated user I get exception saying that "SMTP address has no mailbox associated with it". And exception happens for both servers.

I started to debug and google about possible reasons and out of nothing I changed this:

svc.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, smtpAddress);

into this:

svc.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.PrincipalName, smtpAddress);

and it worked which is very strange because month ago I had different setup only with one server and using SmtpAddress enum worked and my admin swears that config of impersonation is exactly the same.

Now, if anyone could provide me with some hints on why I cannot use ConnectingIdType.SmtpAddress and what I should do to make it possible to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阿楠 2024-11-22 21:42:45

当然,事实证明管理员对我当前的配置采取了不同的方式。新环境有一个策略,即帐户名与帐户的 smtp 地址不同,并且 smtp 在用户的名字和姓氏之间有一个点。因此,例如在旧配置上,我可以模拟 [email protected] 无论如何我选择了什么 ConnectingIdType,但在新环境中我必须设置正确的id 类型取决于我是否使用 smtp 或帐户名作为模拟 id。

希望它能在其他人的管理员“没有更改任何内容”的情况下有所帮助:)

Of course it turned out that admin did something different way for my current configuration. New environment has a policy that account name is different than smtp address for an account and smtp has a dot between name and surname of a user. So, for example on old config I could impersonate [email protected] no matter what ConnectingIdType I chose but on new environment I have to set proper id type depending if I'm using smtp or account name as impersonated id.

Hope it will help in case somebody else's admin "didn't changed anything" too :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文