I have a LDAP directory http://btechintegrator.com/index.php/2020/01/22/free-online-cloud-ldap/ where i wanted to find the user with custom attribute.
I have following for getting all users
public List<Dictionary<string, string>> search(string baseDn, string ldapFilter)
{
var result = new List<Dictionary<string, string>>();
var request = new SearchRequest(baseDn, ldapFilter, SearchScope.Subtree);
if (request != null)
{
var response = (SearchResponse)connection.SendRequest(request);
foreach (SearchResultEntry entry in response.Entries)
{
var dic = new Dictionary<string, string>();
dic["DN"] = entry.DistinguishedName;
foreach (string attrName in entry.Attributes.AttributeNames)
{
//For simplicity, we ignore multi-value attributes
dic[attrName] = string.Join(",", entry.Attributes[attrName].GetValues(typeof(string)));
}
result.Add(dic);
}
}
return result;
}
and I am calling like
var searchResult = client.search("ou=users,o=freeguests,dc=btechsample,dc=com", "objectClass=*");
Any idea what change i could do to get user which are having mobile attribute or the user which are having mobile attribute with certain value