c# – LDAP – 检索所有属性值的列表?

c# – LDAP – 检索所有属性值的列表?,第1张

概述是否可以从LDAP中检索所有属性/值的列表,而不指定,如果可以这样做呢? 我抓住我的DirectoryEntry类对象的所有参数的列表.我希望它会有所帮助: objectClass = System.Object[]cn = Administratorsn = Kwiatek (Last name)c = PL (Country Code)l = Warszawa (City)st = 是否可以从LDAP中检索所有属性/值的列表,而不指定,如果可以这样做呢?解决方法 我抓住我的DirectoryEntry类对象的所有参数的列表.我希望它会有所帮助:
objectClass = System.Object[]cn = administratorsn = Kwiatek (Last name)c = PL (Country Code)l = Warszawa (City)st = MazowIEckIE (Voivodeship)Title = .NET Developerdescription = Built-in account for administering the computer/domainpostalCode = 00-000postOfficeBox = Warszawa UrsynówphysicalDeliveryOfficename = WoJskowa Akademia Technicznagivenname = Piotr (First name)distinguishedname = CN=administrator,CN=Users,DC=helpdesk,DC=wat,DC=eduinstanceType = 4whenCreated = 2012-11-23 06:09:28whenChanged = 2013-02-23 13:24:41displayname = Piotr Kwiatek (Konto administratora)uSNCreated = System.__ComObjectmemberOf = System.Object[]uSNChanged = System.__ComObjectco = Polandcompany = HELPDESKstreetAddress = KaliskIEgo 2wWWHomePage = http://www.piotr.kwiatek.orgname = administratorobjectGUID = System.Byte[]userAccountControl = 512badPwdCount = 0codepage = 0countryCode = 616badPasswordTime = System.__ComObjectlastlogoff = System.__ComObjectlastlogon = System.__ComObjectlogonHours = System.Byte[]pwdLastSet = System.__ComObjectprimaryGroupID = 513objectSID = System.Byte[]adminCount = 1accountExpires = System.__ComObjectlogonCount = 178sAMAccountname = administratorsAMAccountType = 805306368objectcategory = CN=Person,CN=Schema,CN=Configuration,DC=eduisCriticalSystemObject = TruedscorePropagationData = System.Object[]lastlogonTimestamp = System.__ComObjectmail = spam@kwiatek.orgnTSecurityDescriptor = 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# – LDAP – 检索所有属性/值的列表?全部内容,希望文章能够帮你解决c# – LDAP – 检索所有属性/值的列表?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1258186.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-07
下一篇 2022-06-07

发表评论

登录后才能评论

评论列表(0条)

保存