如何使用 C# 和现有 Active Directory 用户以编程方式创建 Exchange 2010 邮箱

发布于 2024-12-17 07:51:22 字数 619 浏览 5 评论 0原文

关注诸如 如何以编程方式创建的帖子使用 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 技术交流群。

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

发布评论

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

评论(3

镜花水月 2024-12-24 07:51:22

您可以通过在 Active Directory 中创建用户来创建新用户。我已经为我的项目完成了此操作。您必须引用 System.DirectoryServices.dll 程序集,并且这些类位于 System.System.DirectoryServices 命名空间中。

连接Active Directory的示例代码如下:

        DirectoryEntry ouser = new DirectoryEntry();
        System.DirectoryServices.PropertyCollection userproperties;

        ouser.Path = "LDAP://CN="Username",CN="", DC="Domain",DC=Com";
        ouser.Username = UserNAme;
        ouser.Password = Password;

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 the System.System.DirectoryServices namespace.

the sample code to connect with Active directory is as follows :

        DirectoryEntry ouser = new DirectoryEntry();
        System.DirectoryServices.PropertyCollection userproperties;

        ouser.Path = "LDAP://CN="Username",CN="", DC="Domain",DC=Com";
        ouser.Username = UserNAme;
        ouser.Password = Password;
自找没趣 2024-12-24 07:51:22

不要调用 New-Mailbox,而是调用 Enable-Mailboxhttp://technet.microsoft.com/en-us/library/aa998251.aspx

Rather than calling New-Mailbox, call Enable-Mailbox. http://technet.microsoft.com/en-us/library/aa998251.aspx

牵你的手,一向走下去 2024-12-24 07:51:22

如果您的工作站与 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?

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