You need to invoke the native Groups method on the objUser object.
In VB.NET this is easy, because of the late binding support offered at the language 
level.

....
Dim MembersCollection as Object    'Underlaying is a IADsMembers interface
 MembersCollection = objUser.Invoke("Groups")
 Dim group As Object        'IADsGroup interface
 for each group in MembersCollection
  Console.WriteLine(" Name: " + user.Name )
 next
...

Willy.

----- Original Message -----
From: "Powell, Simon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 4:01 PM
Subject: [ADVANCED-DOTNET] Listing WinNT:// user group Membership


> Hi,
>
> I using the following code list all properties for a Windows NT 4.0 domain
> user account:
>
> '***************************************************************************
> **********
> Dim objUser As New DirectoryEntry("WinNT://testdom/testuser")
>
> Dim propName As String
> Dim value As Object
>
> For Each propName In objUser.Properties.PropertyNames
>         For Each value In objUser.Properties(propName)
>                 ListBox3.Items.Add("name= " & propName & "  value=" &
> value.ToString)
>       Next value
> Next propName
> '***************************************************************************
> **********
>
> Why doesn't this list the group membership?
> How can I get it to list the group membership for an account?
> If you know of any good books or example code it would be much appreciated?
>
> Thank you
> Simon Powell
>
>
> ----------------------------------------------------------------------
> If you have received this e-mail in error or wish to read our e-mail
> disclaimer statement and monitoring policy, please refer to
> http://www.drkw.com/disc/email/ or contact the sender.
> ----------------------------------------------------------------------
>
> You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
>DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to