
October 1st, 2004, 05:22 AM
|
|
Registered User
|
|
Join Date: Oct 2004
Posts: 3
Time spent in forums: < 1 sec
Reputation 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.
|