I am trying to get the user information for a specific domain which will be the input of the program. On the basis of the domain name it should return the list of the users name/ or NT Id and SID of the user. I am new for the ldap programming can any one help me for get this list.
Share
If you’re on .NET 3.5 and up and talking about Active Directory, then you should check out the
System.DirectoryServices.AccountManagement(S.DS.AM) namespace. Read all about it here:Basically, you can define a domain context and easily find users and/or groups in AD:
The new S.DS.AM makes it really easy to play around with users and groups in AD!
Update: if you need to loop through all the users of a domain – try this:
You can use a
PrincipalSearcherand a “query-by-example” principal to do your searching:Update #2: if you can’t (or don’t want to) use the
S.DS.AMapproach – which is the easiest, for Active Directory, by far – then you need to fall back to theSystem.DirectoryServicesclasses and methods: