J
Jay
Good morning,
I admit, I'm stuck any help in this would be greatly appreciated. I have a
searcher.filter that is currently pulling all objects of type 'person' from
my Active Directory, but I just need members of a particular group. My
problem is that I can't find proper documentation on how to do this nor any
good examples?
I currently have the following as my AD search method:
'Get all users in the G_SCA_CHANGE_CONTROL group
Dim entry As New DirectoryEntry("LDAP://SCA")
Dim searcher As New DirectorySearcher(entry)
Dim result As SearchResult
Dim results As SearchResultCollection
Dim CCGroup As String = "G_someglobal_group"
searcher.Filter = String.Format("(&(objectCategory=person))") 'This is the
line I need to get all 'person' from group CCGroup
searcher.PropertiesToLoad.Add("samAccountName")
searcher.SearchScope = SearchScope.Subtree
results = searcher.FindAll
searcher.Sort.Direction = SortDirection.Ascending
For Each result In results
txtADUserGroup.Text = txtADUserGroup.Text &
result.Properties("samAccountName")(0).ToString() & vbNewLine
Next
Like I said, I just need syntax (or a reference to) for the searcher.filter
to only get users from the ccgroup as defined above.
Thanks in advance,
Jay
I admit, I'm stuck any help in this would be greatly appreciated. I have a
searcher.filter that is currently pulling all objects of type 'person' from
my Active Directory, but I just need members of a particular group. My
problem is that I can't find proper documentation on how to do this nor any
good examples?
I currently have the following as my AD search method:
'Get all users in the G_SCA_CHANGE_CONTROL group
Dim entry As New DirectoryEntry("LDAP://SCA")
Dim searcher As New DirectorySearcher(entry)
Dim result As SearchResult
Dim results As SearchResultCollection
Dim CCGroup As String = "G_someglobal_group"
searcher.Filter = String.Format("(&(objectCategory=person))") 'This is the
line I need to get all 'person' from group CCGroup
searcher.PropertiesToLoad.Add("samAccountName")
searcher.SearchScope = SearchScope.Subtree
results = searcher.FindAll
searcher.Sort.Direction = SortDirection.Ascending
For Each result In results
txtADUserGroup.Text = txtADUserGroup.Text &
result.Properties("samAccountName")(0).ToString() & vbNewLine
Next
Like I said, I just need syntax (or a reference to) for the searcher.filter
to only get users from the ccgroup as defined above.
Thanks in advance,
Jay