473,378 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

finding users in a container

Hi. I wrote the following code that returns the name of all users in our
Active Directory. I want to only find users in a container named 'ABC'. Can
anyone tell me how to do this?

Dim myRootDirectoryEntry As New DirectoryEntry("LDAP://RootDSE")
Dim strDefaultNamingContext As String =
myRootDirectoryEntry.Properties("defaultNamingCont ext").Value.ToString
Dim myDirectoryEntry As New DirectoryEntry("LDAP://" &
strDefaultNamingContext)
Dim myDirectorySearcher As DirectorySearcher = New
DirectorySearcher(myDirectoryEntry)
Dim myArrayList As New ArrayList
Dim intCounter As Integer = 0

myDirectorySearcher.Filter =
"(&(objectCategory=person)(objectClass=user))"
Dim mySearchResultCollection As SearchResultCollection =
myDirectorySearcher.FindAll()

Dim mySearchResult As SearchResult
For Each mySearchResult In mySearchResultCollection

Dim strGroup As String
Dim strName As String
Dim myDirectoryEntry As New DirectoryEntry
myDirectoryEntry = mySearchResult.GetDirectoryEntry()
With myDirectoryEntry
strName = .Properties("samAccountName").Value()
myArrayList.Add(strName)
intCounter = intCounter + 1
End With

Next
Oct 6 '05 #1
0 1298

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
1
by: Luc Le Blanc | last post by:
Under UDB 7.2 for OS/2, how can I determine the % of used space in a DMS container (preferably via the CLP interface, so I can script the command with REXX)? At what level should I go about adding...
3
by: neverstill | last post by:
Hi- I have an asp:image control in the ItemTemplate of a DataList currently, in the ItemDataBound event, I am getting a reference to the image control by looping through all the controls in the...
1
by: Doug | last post by:
The html below shows DataList "DiscountList" nested within DataList "EventItemList". DiscountList contains a Label control. I'm trying to find the label, using FindControl, during...
4
by: News | last post by:
I have a page with many controls. Among these controls there is a table which is a datagrid with nested repeater inside. My problem is that I can not use DataGridCommandEventArgs to get datagrid...
10
by: tshad | last post by:
I have a Datagrid with a column: <asp:HyperLinkColumn DataTextField="JobTitle" DataNavigateUrlField="PositionID" DataNavigateUrlFormatString="AddNewPositions.aspx?PositionID={0}"...
0
by: CLEAR-RCIC | last post by:
Hi. I wrote the following code that returns the name of all users in our Active Directory. I want to only find users in a container named 'ABC'. Can anyone tell me how to do this? Dim...
6
by: Derek Peschel | last post by:
Here are two functions. def invert_dict_to_lists(dict): lists = {} for key in dict: value = dict if not value in lists: lists = else: lists.append(key)
1
by: scrier | last post by:
Hi, I wish to have a baseclass A that class B and C inherits from, C is a standard class that has some get and set functions while B is like C only with a container class that can have 1 or...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.