Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > BOOK: Professional C#, 2nd and 3rd Editions
|
BOOK: Professional C#, 2nd and 3rd Editions
This is the forum to discuss the Wrox book Professional C#, 3rd Edition by Simon Robinson, Christian Nagel, Karli Watson, Jay Glynn, Morgan Skinner, Bill Evjen; ISBN: 9780764557590
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C#, 2nd and 3rd Editions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 30th, 2004, 02:18 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Loding the groups to where a given user is partof

I trying to write an application that search for a given user in active directory and the groups that the given user is part of. The problem is that the user is under a organizational units (folder) and I am not able get to the information.
Bellow is the code that I am using. Can any one help me? Thank you

DirectoryEntry entry = new DirectoryEntry("LDAP://hq-2k3/cn=rtest,cn=IT,DC=kaneCompany,DC=com");
           Console.WriteLine(entry.Properties.Count.ToString( ));
            PropertyValueCollection col = entry.Properties["MemberOf"];
            IEnumerator enumerator = col.GetEnumerator();
            while(enumerator.MoveNext())
            {
                Console.WriteLine("Groups are " + enumerator.Current.ToString());
                //if this gives error then u might need to type case it to AD group object.
            }



Thank you
Wilson






Similar Threads
Thread Thread Starter Forum Replies Last Post
get user groups from Active Directory PorcupineRabbit Classic ASP Professional 1 February 6th, 2007 08:09 PM
Groups Ma7T XSLT 1 August 25th, 2005 12:01 PM
User Groups survey Snib Forum and Wrox.com Feedback 1 January 21st, 2005 09:35 AM
Groups help in 8.5 for VS.net risu Crystal Reports 0 March 15th, 2004 04:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.