LDAP - 检索所有属性/值的列表?

LDAP - Retrieve a list of all attributes/values?(LDAP - 检索所有属性/值的列表?)
本文介绍了LDAP - 检索所有属性/值的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

是否可以在不指定的情况下从 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 = Administrator
sn = Kwiatek (Last name)
c = PL (Country Code)
l = Warszawa (City)
st = Mazowieckie (Voivodeship)
title = .NET Developer
description = Built-in account for administering the computer/domain
postalCode = 00-000
postOfficeBox = Warszawa Ursynów
physicalDeliveryOfficeName = Wojskowa Akademia Techniczna
givenName = Piotr (First name)
distinguishedName = CN=Administrator,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 administratora)
uSNCreated = System.__ComObject
memberOf = System.Object[]
uSNChanged = System.__ComObject
co = Poland
company = HELPDESK
streetAddress = Kaliskiego 2
wWWHomePage = http://www.piotr.kwiatek.org
name = Administrator
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[]
adminCount = 1
accountExpires = System.__ComObject
logonCount = 178
sAMAccountName = Administrator
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();

这篇关于LDAP - 检索所有属性/值的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to determine the type (AD User vs. AD Group) of an account?(如何确定帐户的类型(AD 用户与 AD 组)?)
How to resolve quot;The server does not support the control. The control is critical.quot; Active Directory error(如何解决“服务器不支持控件.控制至关重要.活动目录错误)
How to know if my DirectoryEntry is really connected to my LDAP directory?(如何知道我的 DirectoryEntry 是否真的连接到我的 LDAP 目录?)
Add member to AD group from a trusted domain(将成员从受信任的域添加到 AD 组)
Check if Active Directory password is different from cookie(检查 Active Directory 密码是否与 cookie 不同)
Active Directory: DirectoryEntry member list lt;gt; GroupPrincipal.GetMembers()(Active Directory:DirectoryEntry 成员列表 lt;gt;GroupPrincipal.GetMembers())