Active Directory属性列表使用C#属性、列表、Active、Directory

2023-09-09 21:35:44 作者:夜半诗人

我是如何得到egcn,使用C#邮件等(ieall属性特定用户的不)的Active Directory用户属性的列表?

How i get the list of active directory user attributes(not of particular user i.e.all attributes) e.g.cn,mail etc. using c#?

推荐答案

如果你在.NET 3.5及以上,你需要检查出类 System.DirectoryServices.ActiveDirectory 这一点。你需要看一下类,如 ActiveDirectorySchema ActiveDirectorySchemaClass

If you're on .NET 3.5 and up, you need to check out the classes in System.DirectoryServices.ActiveDirectory for this. You need to look at classes like ActiveDirectorySchema and ActiveDirectorySchemaClass.

您可以通过掌握当前AD架构的:

You can get hold of the current AD schema by using:

ActiveDirectorySchema currSchema = ActiveDirectorySchema.GetCurrentSchema();

当您在当前的模式,您可以检查各种类的定义,如:

When you have the current schema, you can inspect the various class definitions, e.g.:

ActiveDirectorySchemaClass userSchema = currSchema.FindClass("person");

一旦你的对象,就可以检查和枚举它的属性,这样的事情:

Once you have that object, you can inspect and enumerate its properties, things like:

MandatoryProperties OptionalProperties

等来获得洞察AD架构。

and so on to get an insight into the AD schema.