Getting LDAP Retrievals - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Getting LDAP Retrievals

geraldbauergeraldbauer Posts: 7Member
I am accessing an LDAP server and I am only getting one property back, the adspath property, when I have requested three other properties (the adspath is added to the property list by default). Not sure what I am doing wrong. Here is a snipit of the code:

public void StartSearch(){
DirectoryEntry entry = new DirectoryEntry("LDAP://, ou=Company Name, o=company, c=us");
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.SearchScope = SearchScope.Subtree;
searcher.ServerTimeLimit = new TimeSpan(8000);
searcher.PropertyNamesOnly = true;
searcher.Filter ="(personID=14143126)";
SearchResultCollection queryResults = searcher.FindAll();
foreach(SearchResult result in queryResults){
ResultPropertyCollection rpc = result.Properties;
foreach(string colName in rpc.PropertyNames){
foreach(object values in rpc[colName]){
Console.WriteLine(values + "
catch(Exception e){Console.WriteLine(e.Message + "

" + e.ToString());}
I am only getting one values object back, it is the "adspath" that is the path of the LDAP with answers to the ??= as seen in the path. It shows that I have four properties and four PropertiesToLoad.

What have I forgotten to do?

Thank you.


  • geraldbauergeraldbauer Posts: 7Member
    I discovered that the code
    searcher.PropertyNamesOnly = true;
    needed to be
    searcher.PropertyNamesOnly = false;

    My next issue is that the LDAP server is sending me a System.NotImplementedException exception with the message of "Handling of this ADSVALUE type is not yet implemented (type = 0xb)."

    Anyone seen this before?
  • LexCLexC Posts: 10Member
    I have a question on LDAP.
    Here is the scenario: I am logged on to Top domain and the server that the web application is running on in on a SecondLevel domain (subtree).
    I access the web application a workstation and the application uses Global Catalog (DirectoryEntry("GC//")) to get my information from Active Directory. I can't seem to get any information back. I get a message that the server is not operational.

    Could you shed some light on what is going on?

  • geraldbauergeraldbauer Posts: 7Member
    I was getting that message when my path was not set right. It could not find the server. What about authenticating yourself? Have you tried that?

    Hope this is helpful.
  • LexCLexC Posts: 10Member
    : I was getting that message when my path was not set right. It could not find the server. What about authenticating yourself? Have you tried that?
    : Hope this is helpful.

    How do I authenticate myself?
    Also....Can I search a different domain from the one I have my account in? if so, How?

  • emainoemaino Posts: 48Member
    In this code:

    Are you positive that those three values exist in AD? I am not familar with them, though I am also not an AD guru though I have done quite a bit of work with AD, through ADSI.

    Also the following line of code..
    searcher.PropertyNamesOnly = true
    [/code]will only return a property if it has a set value in it, this may be why you are only getting ADSPath returned.

    [size=3][italic]Eric Maino[/italic][/size]
    [b][blue]GVSU[/blue] Microsoft SA[/b]

  • geraldbauergeraldbauer Posts: 7Member
    : [code]
    : searcher.PropertiesToLoad.Add("freeFormName");
    : searcher.PropertiesToLoad.Add("title");
    : searcher.PropertiesToLoad.Add("personID");
    : [/code]
    These properties are user defined. They are not supported. I have been told that I must go after the native APIs. I am confused as to why and how.
Sign In or Register to comment.