LDAP - 检索所有属性/值的列表?
- 作者: 亖呉?盀
- 来源: 51数据库
- 2022-10-21
问题描述
是否可以在不指定的情况下从 LDAP 检索所有属性/值的列表,如果可以,这怎么可能?
Is it possible to retrieve a list of all attributes/values from LDAP without specifying, if so how can this be possible?
推荐答案
我抓取我的 DirectoryEntry 类对象的所有参数列表.我希望它会有所帮助:
I grab list of all parameters my DirectoryEntry class object. I hope it will help:
objectClass = System.Object[] cn = *****istrator sn = Kwiatek (Last name) c = PL (Country Code) l = Warszawa (City) st = Mazowieckie (Voivodeship) title = .NET Developer description = Built-in account for *****istering the computer/domain postalCode = 00-000 postOfficeBox = Warszawa Ursynów physicalDeliveryOfficeName = Wojskowa Akademia Techniczna givenName = Piotr (First name) distinguishedName = CN=*****istrator,CN=Users,DC=helpdesk,DC=wat,DC=edu instanceType = 4 whenCreated = 2012-11-23 06:09:28 whenChanged = 2013-02-23 13:24:41 displayName = Piotr Kwiatek (Konto *****istratora) uSNCreated = System.__ComObject memberOf = System.Object[] uSNChanged = System.__ComObject co = Poland company = HELPDESK streetAddress = Kaliskiego 2 wWWHomePage = http://www.piotr.kwiatek.org name = *****istrator objectGUID = System.Byte[] userAccountControl = 512 badPwdCount = 0 codePage = 0 countryCode = 616 badPasswordTime = System.__ComObject lastLogoff = System.__ComObject lastLogon = System.__ComObject logonHours = System.Byte[] pwdLastSet = System.__ComObject primaryGroupID = 513 objectSid = System.Byte[] *****Count = 1 accountExpires = System.__ComObject logonCount = 178 sAMAccountName = *****istrator sAMAccountType = 805306368 objectCategory = CN=Person,CN=Schema,CN=Configuration,DC=helpdesk,DC=wat,DC=edu isCriticalSystemObject = True dSCorePropagationData = System.Object[] lastLogonTimestamp = System.__ComObject mail = spam@kwiatek.org nTSecurityDescriptor = System.__ComObject
这里你有代码:
string currentUserSid = WindowsIdentity.GetCurrent().User.Value;
PrincipalContext ctx = new PrincipalContext(
ContextType.Domain,
"helpdesk.wat.edu");
UserPrincipal up = UserPrincipal.FindByIdentity(
ctx, IdentityType.Sid,
currentUserSid);
/*
*
*/
DirectoryEntry entry = up.GetUnderlyingObject() as DirectoryEntry;
PropertyCollection props = entry.Properties;
/*
*
*/
foreach (string propName in props.PropertyNames)
{
if (entry.Properties[propName].Value != null)
{
Console.WriteLine(propName + " = " + entry.Properties[propName].Value.ToString());
}
else
{
Console.WriteLine(propName + " = NULL");
}
}
Console.ReadKey();
推荐阅读
- C#通过fleck实现wss协议的WebSocket多人Web实时聊天(附源码)
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源
热点文章
团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
0
使用 MSBuild.exe 在发布模式下构建 C# 解决方案
0
当我发布 Web 应用程序时,AfterPublish 脚本不运行
0
构建时 T4 转换的产品仅在下一个构建中使用
0
ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
0
新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
0
如何将条件编译符号(DefineConstants)传递给 msbuild
0
MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
0
NuGet 包还原找不到包,没有源
0
使用 C# 6.0 功能运行 TFS 构建
0
