[英]Can I add Active Directory properties to be loaded in UserPrincipal?
Using the DirectorySearcher we can specify which properties can be loaded when searching in the AD. 使用DirectorySearcher,我们可以指定在AD中搜索时可以加载的属性。
DirectorySearcher dsLookForDomain = new DirectorySearcher(deBase);
dsLookForDomain.PropertiesToLoad.Add("msDS-PrincipalName");
I'm interested in loading msDS-PrincipalName property. 我对加载msDS-PrincipalName属性感兴趣。 Is this possible?
这可能吗?
I'm not sure if this is going to help anynone but I found an alternative to the msDS-PrincipalName. 我不确定这是否对您有帮助,但是我找到了msDS-PrincipalName的替代方法。
userPrincipal.Sid.Translate(typeof (NTAccount)).ToString()
This will return the same thing the property mentioned above does which is: DOMAIN\\Username 这将返回上述属性所做的相同操作: DOMAIN \\ Username
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.