在.Net中访问Active Directory中的用户经理samaccount [英] Accessing user's manager samaccount in Active Directory in .Net
问题描述
你好!
我正在尝试访问用户的经理sAMaccount.我知道如何访问用户的管理员属性信息.但是,有没有办法直接获得经理的sAMaccount?是否没有抓住名称并再次查询?
I am trying to access manager sAMaccount for the user. I know how to access the manager attribute information for the user. But is there a way of getting sAMaccount of the manager directly? Without grabbing the name and querying again?
根据我的阅读,看来用户有一个manager对象.有人有这样做的经验吗?
From what I read, it looks like user has a manager object. Does anyone have any experience doing this?
谢谢.
推荐答案
另一步骤是必需的,但这不是查询.您可以使用manager属性(a DN)的值绑定到manager对象,然后检索该对象的sAMAccountName属性的值.
Another step is necessary, but it is not a query. You can use the value of the manager attribute (a DN) to bind to the manager object, then retrieve the value of the sAMAccountName attribute of this object.
另一种方法是使用NameTranslate对象将管理器值(专有名称)转换为表单Domain \ NTName,其中Domain是域的NetBIOS名称,而NTName是sAMAccountName.
Another method would be to use the NameTranslate object to convert the manager value, a distinguishedName, into the form Domain\NTName, where Domain is the NetBIOS name of the domain, and NTName is the sAMAccountName.
IADsNameTranslate界面上的文档链接.
Link for documentation on the IADsNameTranslate interface.
https://msdn.microsoft.com/en-us/library/Aa706046.aspx
并且此链接主要适用于VBScript(和PowerShell),但是#11显示了如何将专有名称转换为sAMAccountName.底部还有更多链接.
And this link applies mostly to VBScript (and PowerShell), but # 11 shows how to convert a distinguished name into a sAMAccountName. There are also more links at the bottom.
http://www.rlmueller.net/NameTranslateFAQ.htm
这篇关于在.Net中访问Active Directory中的用户经理samaccount的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!