Active Directory - User List/Modification

Posted on 2007-10-17
Last Modified: 2013-11-26

Please note I'm programming in VB.NET and not classic ASP or C#
Here's what I need. I need to create web (VB.NET) application that will access Active Drictory and dispaly all current users (user list).  I want to retreive acouts from specific OUs (OU1, OU2) and some user acouts should not be in the list (like: previous employees, disable acounts, system acounts, etc).
When user is clicked (can be a link) I need to provide a way to update his/her information.

And one more thing. Later on we would like to use this kind of approach with SharePoint MOSS 2007. Is it possible to do so and what would be approach to accomplish this task? I never had a chance to work with SharePoint and my knowledge of it is very basic (I know what it's for).

Thank you,
Question by:IOIT
    1 Comment
    LVL 3

    Accepted Solution

    Your first "question" is a very open-ended.  A little Google goes a long way to starting your application:
    Unfortunately, AD is rather explicit and environments can differ according to administrative styles.  Finding all active users and gathering their name, email address, class memberships (for possibly qualifying system accounts), their GUID, and manager, for example:

                Static strActiveOnly As String = "(&(objectCategory=user)(objectClass=user)(!UserAccountControl:1.2.840.113556.1.4.803:=2))"
                Dim adRoot As New DirectoryServices.DirectoryEntry("LDAP://daldc1.tarragoncorp.local/DC=tarragoncorp,DC=local")
                With adRoot
                    .Username = Nothing
                    .Password = Nothing
                    .AuthenticationType = DirectoryServices.AuthenticationTypes.Delegation
                End With
                Dim adUserSearcher As New DirectoryServices.DirectorySearcher(adRoot, strActiveOnly)
                With adUserSearcher
                    .SearchScope = DirectoryServices.SearchScope.Subtree
                    .PageSize = 1000
                End With
                    Dim adUserResults As DirectoryServices.SearchResultCollection = adUserSearcher.FindAll

    Filtering your results will be dependant on your AD environment, and how users have been assigned/distinguished, so only specific questions could be answered.

    As to your second question, yes you can code web parts to include in MOSS.  It's already heavilly dependant on active directory for its security, so including something like this is not uncommon - out of the box, SharePoint already includes the capicity to email between one another based on the email address imported from AD.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now