#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    3
    Rep Power
    0

    Retrieve LDAP attribuild


    Hi Expect,

    can anyone please help me. i using the following

    using (DirectoryEntry de = new DirectoryEntry(ConfigurationSettings.AppSettings[ldappath] + ConfigurationSettings.AppSettings[ldapbase]))
    using (DirectorySearcher searcher = new DirectorySearcher())
    {
    searcher.SearchRoot = de;
    searcher.Filter = "(cn=Tze Yang*)";//*" + this.txtSearch.Text.ToString() + "*)";
    searcher.SearchScope = SearchScope.Subtree;
    searcher.PropertiesToLoad.Add("mail"); searcher.PropertiesToLoad.Add("givenname"); searcher.PropertiesToLoad.Add("jobtitle");
    SearchResultCollection results = searcher.FindAll();

    foreach (SearchResult result in results)
    {
    ResultPropertyCollection props = result.Properties;
    string Email = props["mail"][0].ToString();
    string Name = props["givenname"][0].ToString() + " " + props["postaladdress"].ToString();
    string jobTitle = props["jobtitle"][0].ToString();
    .........
    }

    to queri the LDAP server. Happen that if i query using eudora, i can get the attribuild for the jobtitle. but when i using the above code and try to get the jobtitle. it throw error. and i check thru all the return record (total 58), the jobtitle is not there. but i am sure that this i-Planet LDAP contain this attribuild. Please help.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    Stuttgart
    Posts
    50
    Rep Power
    11
    do you mean "attribute" instead of "attribuild"?

    If you want to know, whether the attribute is supported you your LDAP Server you have to look in the Servers Shema.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    3
    Rep Power
    0

    Please help


    Hi,

    Oops....wrong spelling.
    back to the topic. i am sure that the attribute is exist seeing that i can use others query method to get it. just happen that when i use the directory service, it is not there. so i really don't understand. please help
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    Stuttgart
    Posts
    50
    Rep Power
    11
    Where do you bind as an user with administration rights? I can't see the connection line. If you bind a anonymous, you probabaly don't have the rights for searching the wanted attribute.

    ps: are you german?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    3
    Rep Power
    0

    Please help


    Hi,

    i am not german.
    nop. this server do not require admin login. i use others connection also did not authenticate but it can work. thanks for your advice in advance.

IMN logo majestic logo threadwatch logo seochat tools logo