yobo
yobo

Reputation: 49

How to get all Active Directory user details using Search Filter Syntax

How can I get all users properties like (email, address, phone and etc..) using search filter syntax?

Can't find anything in the docs.

I tried this

(&(objectCategory=person)(objectClass=user)(cn=Erika Wynn))

but all I get is the dn details :

CN=Erika Wynn,CN=Users,DC=****,DC=local

I wish to get all user fields General (telephone, email..), Address (Street, City), Organization.

Upvotes: 0

Views: 458

Answers (2)

yobo
yobo

Reputation: 49

I should of just provide a user name similar to AD login, as a filter and any attribute I needed to get.

I used this great article, to get all the different attributes that you can fetch from Active Directory. https://www.manageengine.com/products/ad-manager/help/csv-import-management/active-directory-ldap-attributes.html

this is the query:

filter=(sAMAccountName=username) attributes=cn,department,company,streetAddress,L,st,co,mail

Upvotes: 0

Gabriel Luci
Gabriel Luci

Reputation: 40928

LDAP allows you to specify which attributes you want to receive. If you do not specify anything, Active Directory will return every attribute that has a value. So if it is not doing that in your case, then there must be some part of the code that has set the list of attributes to only the distinguishedName.

You will have to show your code for us to help you more. You can update your question to include your code.

Upvotes: 1

Related Questions