【发布时间】:2016-05-05 13:11:13
【问题描述】:
我有一个 Active Directory 搜索器,可以使用 UserPrincipal 对象获取用户的详细信息。我正在使用System.DirectoryServices 和System.DirectoryServices.AccountManagement,它通过上下文访问AD。
但是,我还需要将用户的经理作为单独的UserPrincipal 对象。最直接的方法是什么?
我尝试了以下方法,但不幸的是,演员阵容不起作用:
DirectoryEntry directoryEntry = (DirectoryEntry)userPrincipal.GetUnderlyingObject();
UserPrincipal manager = (UserPrincipal)directoryEntry.Properties["manager"][0];
我希望在每个 UserPrincipal 对象中都有一个名为 UsersManager 的 UserPrincipal 属性,但我找不到这个,所以我猜没有这样的东西。
谢谢!
【问题讨论】:
标签: c# active-directory directoryservices