Active Directory Display all properties in a table

后端 未结 3 1156
悲&欢浪女
悲&欢浪女 2021-02-16 00:06

I am trying to achieve an LDAP query to gather all properties we have about our users without specifying the properties before hand, I would like to display this in a table so u

3条回答
  •  迷失自我
    2021-02-16 00:22

    You can iterate through all properties this way:

    foreach (SearchResult searchResult in allResults)
    {
      foreach (string propName in searchResult.Properties.PropertyNames)
      {
        ResultPropertyValueCollection valueCollection =
        searchResult.Properties[propName];
        foreach (Object propertyValue in valueCollection)
        {
        Console.WriteLine("Property: " + propName + ": " + propertyValue.ToString());
        }
      }
    }
    

    Is that what you need?

提交回复
热议问题