如何使用 C# 和现有 Active Directory 用户以编程方式创建 Exchange 2010 邮箱
关注诸如 如何以编程方式创建的帖子使用 C# 的 Exchange 2010 邮箱 和 http://blog.pedroliska.com/2011/07/28/creating-an-exchange-2010-mailbox-from-a-remote-c-program/#comment-250 看起来像我将能够从远程 C# 程序在 Exchange 服务器上创建执行 cmdlet 的邮箱。
我现在的问题是如何使用现有的 Active Directory 用户帐户创建这个新邮箱。我知道我可以在 Exchange UI 上执行此操作,因此我只是想知道是否可以通过 cmdlet 以编程方式执行此操作以及如何执行此操作。
谢谢
Following posts like How do I programatically create an exchange 2010 mailbox using C# and http://blog.pedroliska.com/2011/07/28/creating-an-exchange-2010-mailbox-from-a-remote-c-program/#comment-250 looks like I will be able to create a mailbox executing cmdlets on the Exchange server from a remote C# program.
My question now is how do I do to create this new mailbox using an existing Active Directory user account. I know I can do this on the Exchange UI so I'm just wondering if its possible to do it programatically through the cmdlets and how.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过在 Active Directory 中创建用户来创建新用户。我已经为我的项目完成了此操作。您必须引用 System.DirectoryServices.dll 程序集,并且这些类位于 System.System.DirectoryServices 命名空间中。
连接Active Directory的示例代码如下:
You can create new user by creating user in Active directory. I have done it for my project.You have to reference the
System.DirectoryServices.dll
assembly and the classes are in theSystem.System.DirectoryServices
namespace.the sample code to connect with Active directory is as follows :
不要调用
New-Mailbox
,而是调用Enable-Mailbox
。 http://technet.microsoft.com/en-us/library/aa998251.aspxRather than calling
New-Mailbox
, callEnable-Mailbox
. http://technet.microsoft.com/en-us/library/aa998251.aspx如果您的工作站与 Exchange 服务器位于不同的站点,则需要确保您的用户位于 Exchange 服务器使用的同一个 DC 上,否则,当您尝试为您的 Exchange 服务器启用邮件时用户你会发现他(她)还不存在(就Exchange Server的DC而言)
有人知道如何从远程确定ExchangeServer正在使用哪个DC(在C#中)吗?
If your workstation is in a different Site than your exchange server, you're going to need to make sure that you're making your user on the same DC that the Exchange server is using, otherwise, when you try to mail-enable your User you'll find that (s)he doesn't exist yet (as far as the Exchange Server's DC is concerned)
Anyone know a way to determine which DC an ExchangeServer is using (in C#) from remote?