Solved

Search for subgroups within a group using ADSI

Posted on 2003-11-18
5
294 Views
Last Modified: 2007-12-19
Hi,
I am trying to get the groups included in another group using ADSI. In the principal group  I have users and groups on it. I´m trying to get these groups included on the principal filtering the members collection, but i'm not getting the collection filtered. I'm using following code:

Dim adsgroup As ActiveDs.IADsGroup
      Dim adsSubGroup As ActiveDs.IADs
      Dim sFilter() As String

            adsgroup = GetObject(sFormattedGroupName)
            ReDim Preserve sFilter(0)
            sFilter(0) = "Group"
            adsMembers = adsgroup.Members

            adsMembers.Filter = sFilter

            For Each adsMembers In adsMembers

           next

Can anyone tell me why this is not working?

Thank you
0
Comment
Question by:purbano
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 8

Expert Comment

by:Dranizz
ID: 9771447
There could be members of members, so use a function that recall itself if that appends

Also

  sFilter(0) = ("(objectClass=group)")

remember that filter is case sensitive, so the class type and the classname are case sensitive
0
 

Author Comment

by:purbano
ID: 9771721
Thank you Dranizz, but I'm afraid it doesn't work.

Any other idea.

Thanks
0
 
LVL 8

Accepted Solution

by:
Dranizz earned 250 total points
ID: 9771795
Use the DirectoryServices.Dll reference
and use the DirectorySearcher class

look at this

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdirectoryservicesdirectorysearcherclasstopic.asp
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10268131
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: Dranizz {http:#9771795}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 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