【发布时间】:2012-01-19 14:00:14
【问题描述】:
我一直在尝试检索在我们的 Active Directory 用户上设置的两个自定义属性,但似乎我不断获得属性列表(在 2 个不同的 AD 服务器上测试)
假设我要获取的属性是prop1 和prop2,我在以下代码中做错了什么:
List<String> nProps = new List<string>();
DirectoryEntry directoryEntry = new DirectoryEntry("WinNT://DOM");
foreach (DirectoryEntry child in directoryEntry.Children)
{
// No filtering; ignore schemes that are not User schemes
if (child.SchemaClassName == "User")
{
foreach (var sVar in child.Properties.PropertyNames)
nProps.Add(sVar.ToString());
break;
}
}
nProps 不包含我的任何自定义属性(不是prop1 也不是prop2)
(它确实包含其他属性,例如 BadPasswordAttempts、用户名等)
有什么想法吗?
【问题讨论】:
-
您是否遇到与stackoverflow.com/questions/7827328/…相同的问题?
-
@Brandon nope.. 尝试切换到 LDAP:// - 现在什么都没有
标签: c# winforms active-directory ldap