我的组织使用Active Directory。对于内部通信,我们使用alias@organization.com地址。
我正在寻找一个API,它可以让我像这样解析“别名”:
jonvu@org.com是电子邮件,jonvu是别名,所以我想找到联系人的名字,如下所示:
John Von Neumann.PS: C++/C/C#中的API
谢谢你的帮助。
干杯-B
发布于 2012-08-21 17:06:23
如果您使用的是.NET 3.5或更高版本,则应该查看System.DirectoryServices.AccountManagement (S.DS.AM)名称空间。请在这里阅读所有相关内容:
基本上,您可以定义域上下文并轻松查找AD中的用户和/或组:
// 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中处理用户和组变得非常容易!
发布于 2012-08-21 17:02:45
您好,您可以在这里找到关于不同API的文章: COM或.Net
http://www.c-sharpcorner.com/UploadFile/john_charles/AccessingtheActiveDirectoryfromMicrosoftNET04172007154931PM/AccessingtheActiveDirectoryfromMicrosoftNET.aspx
在我的例子中,我在System.DirectoryServices名称空间中使用了DirectorySearcher
https://stackoverflow.com/questions/12051446
复制相似问题