如何使用C#获取Active Directory中的子OU的父OU?

编程入门 行业动态 更新时间:2024-10-28 18:29:05
本文介绍了如何使用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?

本文发布于:2023-11-09 03:24:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571264.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   Active   OU   Directory

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!