如何使用C#获取Active Directory中的子OU的父OU? [英] how Get parent OU of child ou in Active Directory using C#?
本文介绍了如何使用C#获取Active Directory中的子OU的父OU?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用C#获取子目录中的子OU,使用C#
如何使用C#在Active Directory中获取子OU的父OU br />
如何在Active Directory中使用C#获取子OU的父OU?
如何在Active Directory中使用C#获取子OU的父OU
如何使用C#获取子目录中的子OU,使用C#
如何使用C#
how Get parent OU of child ou in Active Directory using C#
how Get parent OU of child ou in Active Directory using C#
how Get parent OU of child ou in Active Directory using C#
how Get parent OU of child ou in Active Directory using C#
how Get parent OU of child ou in Active Directory using C#
how Get parent OU of child ou in Active Directory using C#
推荐答案
您可以使用DirectoryEntry对象的Path属性。
You can use the Path property of your DirectoryEntry object.
DirectoryEntry user = null;
DirectoryEntry gcEntry = new DirectoryEntry("GC:");
IEnumerator ie = gcEntry.Children.GetEnumerator();
while (ie.MoveNext())
{
gcEntry = (DirectoryEntry)ie.Current;
}
using (DirectorySearcher searcher = new DirectorySearcher(gcEntry))
{
searcher.Filter = string.Format(ldapQueryString);
SearchResult result = searcher.FindOne();
string[] pathParts = user.Path.Split(new char[] { ',', ' ' });
}
这篇关于如何使用C#获取Active Directory中的子OU的父OU?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文