Using the DirectorySearcher we can specify which properties can be loaded when searching in the AD.
DirectorySearcher dsLookForDomain = new DirectorySearcher(deBase);
dsLookForDomain.PropertiesToLoad.Add("msDS-PrincipalName");
I'm interested in loading msDS-PrincipalName property. Is this possible?
I'm not sure if this is going to help anynone but I found an alternative to the msDS-PrincipalName.
userPrincipal.Sid.Translate(typeof (NTAccount)).ToString()
This will return the same thing the property mentioned above does which is: DOMAIN\\Username
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.