本质上,我想查询用户 objectClass的模式,以便我知道用户对象可能具有的所有可能的属性名称,但我不想实际查找用户来执行此操作。
基于我在此处回答的一个子集,您可以User
使用架构实例的 FindClass() 方法获取类的属性。
请找到下面的代码来实现你想要的:
DirectoryEntry entry = new DirectoryEntry(
"LDAP://CN=Schema,CN=Configuration,DC=domain,DC=local",
null, null, AuthenticationTypes.Secure);
ActiveDirectorySchema schema = ActiveDirectorySchema.GetCurrentSchema();
// below code retrieves Active Directory Domain Services class "User" in the schema.
ActiveDirectorySchemaClass user = schema.FindClass("User");
foreach (ActiveDirectorySchemaProperty property in user.GetAllProperties())
{
Console.WriteLine("{0}", property.Name);
}
您可以在 Microsoft docs 上获取有关User 类属性的更多详细信息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句