Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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, 12:10 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Searching Active Directory

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.ToS tring());
            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
Searching for a user in Active Directory with ASP Ricapar Classic ASP Professional 1 July 15th, 2008 11:07 PM
Searching Directory Engine Renich PHP How-To 4 October 29th, 2004 09:07 AM
Searching Active Directory schenkp ASP.NET 1.0 and 1.1 Basics 4 September 21st, 2004 11:35 AM
Searching Active Directory levinll VB How-To 1 June 8th, 2004 08:47 AM
Active Directory Searching schenkp C# 1 July 11th, 2003 03:41 PM





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