I have to check the LDAP Active Directory usergroup for specific user in C #. This means that I pass this username into a method and it gives me a list of the group from that user. Can you help me in this
Domain Name: Arsenal
Username: ArslanP
Password: testad
Since you are at .NET 3.5 and up, you have the Actually, the assembly New SDS AM makes it easy to play around with groups in AD users and AD: system. Directory Services Account Management [/ Code> (SDS.AM) Namespace Read all about it:
system Directory Services Add in the context of account management , and then you can define a domain reference and easily find users and / or groups in AD:
system. Directory Services Account management; Public list & amp; group; Group Pinchip & gt; GetGroupsForUser (String Username) {List & amp; group; Group Pinyitham & gt; Results = New list & amp; group; Group Pinyitham & gt; (); // Set up domain reference - If you make a lot of requests, you want to make // out of method and pass it as Principal Principal Contaxx ctx = new PrincipalContext (ContextType.Domain); // Find User by User NamePrint Users = UserPrint.FundbyINDTT (Username); // Get user groups if (user! = Null) {foreach (user in group pinipinal GP. GetAuthorizationGroups ()) {result.Add (gp); }} Return result; }
Comments
Post a Comment