注意:我要查找的所有属性都在UserPrincipal中公开。下面是一个使用UserPrincipal而不使用部分名称搜索的示例。using (UserPrincipal user = UserPrincipal.FindByIdentity(ctx, IdentityType.SamAccountName, userName)){ } using (UserPrincipal<
我实现了System.DirectoryServices.AccountManagement来对我的for应用程序进行身份验证,通过给定的用户名查找用户(UserPrincipal)。有什么好方法可以让UserPrincipal (甚至只有sAMAccountName)在AccountManagement中获得employeeID呢?PrincipalContext adAuth = new PrincipalContext(ContextType.Domain, Environment.UserDomainName);
//get u
这个库是在.NetStandard 2.0中,我使用的是由于UserPrincipal类不包含我们需要的所有属性,下面是我的类:[DirectoryRdnPrefix("CN")]
public class UserPrincipalExtended : UserPrincipalFindByIdentityWithType(context, typeof(UserPr