从c#读取ldap组成员
我有这段代码可以连接到 Active Directory 并获取所有存在的组,它可以工作并返回结果中的所有组:
DirectoryEntry dirEnt = new DirectoryEntry();
using (DirectorySearcher srch = new DirectorySearcher(dirEnt, "(objectClass=Group)"))
{
srch.PageSize = 1000;
SearchResultCollection results = srch.FindAll();
}
我现在想要返回特定组的用户,即管理员,我将如何处理?
我曾尝试将 (objectClass=Group) 更改为 (objectClass=Group)(cn=admin) 但随后它没有返回任何结果。
一切顺利
I have this code to connect to Active Directory and get all the groups that exist, it works and returns all the groups in results :
DirectoryEntry dirEnt = new DirectoryEntry();
using (DirectorySearcher srch = new DirectorySearcher(dirEnt, "(objectClass=Group)"))
{
srch.PageSize = 1000;
SearchResultCollection results = srch.FindAll();
}
I now want to return users of a specific group i.e. Administrators, how would I go about this?
I had tried changing (objectClass=Group) to (objectClass=Group)(cn=admin) but then it returns no results.
All the best
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是有关如何在 Active Directory 中进行操作的参考:
Howto:(几乎)Active Directory 中的所有内容C#
Here's a reference about how to in Active Directory:
Howto: (Almost) Everything In Active Directory via C#