473,396 Members | 1,864 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,396 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 1300

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.