0
给定一个AD条目,如何获取用户的完整合格域名?从用户AD条目中获取完整合格域名
到现在为止我用
((string)directoryEntry.Properties["userPrincipalName"].Value).Split('@')[1]
但userPrincipalName
是不是必需的属性,所以我想我需要一个备用的......
给定一个AD条目,如何获取用户的完整合格域名?从用户AD条目中获取完整合格域名
到现在为止我用
((string)directoryEntry.Properties["userPrincipalName"].Value).Split('@')[1]
但userPrincipalName
是不是必需的属性,所以我想我需要一个备用的......
我相信,“CN”是在公元强制属性,根据我的经验,它与登录值具有相同的值,因此您可以尝试。 虽然我不是100%确定,所以试试吧,让我们知道,如果不是,我会删除这个答案。
希望它有帮助。
以我的示例用户'userPrincipalName'为'matslehmann @ intra.contoso.com','cn'为'Mats Lehmann',我需要域名,即'intra.contoso.com'。但thx的尝试。 – Alexander 2014-10-20 13:57:01
也许是sAMAccountName?也是强制的。看看这个网站的更多属性:http://www.kouti.com/tables/userattributes.htm – Koen 2014-10-20 14:02:28