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 – 检索所有属性/值的列表?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)