Active Directory Attribute List Using c#(使用 c# 的 Active Directory 属性列表)
问题描述
我如何使用 c# 获取活动目录用户属性(不是特定用户,即所有属性)的列表,例如 cn、mail 等?
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:
- 强制属性
- 可选属性
等等以深入了解 AD 架构.
and so on to get an insight into the AD schema.
这篇关于使用 c# 的 Active Directory 属性列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 c# 的 Active Directory 属性列表
基础教程推荐
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
