vb.net array of ldap objects

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm writing a vb.net application to add new users to Active Directory 2003.
I am looking to find out if it is possible to store ldap objects in an array.
I have tried the following:

Dim Groups As Array =
Array.CreateInstance(GetType(DirectoryServices.DirectoryEntry), 5)

Then depending on which department the user is in, the code adds the groups
required to the array using the following code.

Groups.SetValue(GetObject("-ldap path to group here-"), gCtr)
gCtr = gCtr + 1

After getting all the groups the user should be in, I am using the following
code to try to add the user to the groups.

Dim i As Integer
Dim Group As DirectoryServices.DirectoryEntry
For i = 0 To Groups.Length - 1
Group = New DirectoryServices.DirectoryEntry(GetObject(Groups(i)))
Group.Invoke("Add", New Object() {"-ldap path to user here-"})
Group = Nothing
Next

When I run the program, I am getting an error on the first line where it
tries to add a group object to the "Groups" array. The error states that the
"Object cannot be stored in an array of this type."

Any help will be greatly appreciated.

Thanks,
 
Andy,

Really do not think that you are going to get much of a reply in this ng.
You might want to post this in the ADSI or dotnet news groups. There you
will have a much better chance. Joe R or Joe K or Lee Flight ( in the ADSI
news groups ) will have a quick answer for you I am sure!

--
Cary W. Shultz
Roanoke, VA 24012
Microsoft Active Directory MVP

http://www.activedirectory-win2000.com
http://www.grouppolicy-win2000.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top