c# - 查找 LDAP 用户的管理器

标签 c# active-directory ldap

我希望能够找到谁是特定用户的管理员。我不知道从哪里开始。请帮忙。

最佳答案

您需要知道您的用户的 LDAP 路径是什么 - 如果您不知道,您可能需要下载我的 LDAP 浏览器 BeaverTail .

enter image description here

一旦您知道您的用户的 LDAP 路径是什么样子,就很容易了:通过其 LDAP 路径绑定(bind)到该用户,并获取它的 Manager 属性:

DirectoryEntry deUser = new DirectoryEntry("LDAP://cn=John Doe,cn=Users,dc=YourCorp,dc=com");

if(deUser != null)
{
   // check if the manager property is set - it could be NULL (no manager defined)
   if(deUser.Properties["manager"] != null)
   {
      string managerDN = deUser.Properties["manager"][0].ToString();
   }
}

Manager 属性再次包含一个“专有名称”(DN) - 即 LDAP 路径 - 用于管理器的 DirectoryEntry

关于c# - 查找 LDAP 用户的管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5357345/

相关文章:

c# - MVC 中的样式下拉列表

windows - Active Directory - 用于查找不在一组组中的所有用户的脚本?

authentication - 如何告诉具有多个证书的 LDAP SSL 服务器返回我需要的证书?

java - Ldap:监听外部所做的更改

c# - visual studio 2010 条件引用

c# - ListView - 如何将项目添加到列表的前面

C# ActiveDirectory,如何将范围添加到过滤器

c# - Azure AD 身份验证 : Permission error while fetching access token

java - 某些属性的某些字符的 LDAP 搜索失败

c# - 使用资源字典:中定义的样式