gpt4 book ai didi

c# - 事件目录别名

转载 作者:太空宇宙 更新时间:2023-11-03 13:56:21 25 4
gpt4 key购买 nike

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

我正在寻找一个允许我解析“别名”的 API,例如:

jonvu@org.com 是电子邮件,jonvu 是别名,所以我想找到看起来像这样的联系人姓名:

John Von Neumann.

附言:C++/C/C# 中的 API

感谢您的帮助。

干杯-B

最佳答案

如果您使用的是 .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 中与用户和组一起玩真的很容易!

关于c# - 事件目录别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12051446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com