October 1st, 2004, 06:22 AM
Retrieve LDAP attribuild
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"].ToString();
string Name = props["givenname"].ToString() + " " + props["postaladdress"].ToString();
string jobTitle = props["jobtitle"].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.
October 8th, 2004, 05:22 AM
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.
October 8th, 2004, 05:36 AM
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
October 8th, 2004, 05:44 AM
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?
October 8th, 2004, 05:48 AM
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.