首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Active Directory别名

Active Directory别名
EN

Stack Overflow用户
提问于 2012-08-21 16:59:29
回答 2查看 2K关注 0票数 2

我的组织使用Active Directory。对于内部通信,我们使用alias@organization.com地址。

我正在寻找一个API,它可以让我像这样解析“别名”:

jonvu@org.com是电子邮件,jonvu是别名,所以我想找到联系人的名字,如下所示:

代码语言:javascript
复制
John Von Neumann.

PS: C++/C/C#中的API

谢谢你的帮助。

干杯-B

EN

回答 2

Stack Overflow用户

发布于 2012-08-21 17:06:23

如果您使用的是.NET 3.5或更高版本,则应该查看System.DirectoryServices.AccountManagement (S.DS.AM)名称空间。请在这里阅读所有相关内容:

  • Managing Directory Security Principals in the .NET Framework 3.5
  • MSDN docs on System.DirectoryServices.AccountManagement

基本上,您可以定义域上下文并轻松查找AD中的用户和/或组:

代码语言:javascript
复制
// set up domain context
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);

// find a user - this searches for a variety of name-related attributes
// maybe that also finds your "alias" - depending on where in AD this is stored..
UserPrincipal user = UserPrincipal.FindByIdentity(ctx, "SomeUserName");

if(user != null)
{
   // do something here....     
}

新的S.DS.AM使得在AD中处理用户和组变得非常容易!

票数 1
EN

Stack Overflow用户

发布于 2012-08-21 17:02:45

您好,您可以在这里找到关于不同API的文章: COM或.Net

http://www.c-sharpcorner.com/UploadFile/john_charles/AccessingtheActiveDirectoryfromMicrosoftNET04172007154931PM/AccessingtheActiveDirectoryfromMicrosoftNET.aspx

在我的例子中,我在System.DirectoryServices名称空间中使用了DirectorySearcher

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12051446

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档