本文介绍了如何使用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?
发布评论