import dll issue

R

richb330

Hi,

I have got hold of a script from the ms web site that adds an entry into the
active directory. I have copied the script into VB(.net 2003) and made the
reference to the system.directoryservices dll but all of the references
within the script that state 'DirectryEntry' all state Type 'Directory
Entry' is not defined. I think i've imported the dll correctly through
solution explorer and I can see the System.DirectoryServices within the
References section. do i need to make reference to the dll within the vb
program statements?

This is the script:

Try

' Bind to the Users container, add a new group and a new contact.

Dim de As New DirectoryEntry("LDAP://CN=temp,DC=mdlmarinas,DC=co,DC=uk")

Dim newGroup As DirectoryEntry = de.Children.Add("CN=Temp", "user")

newGroup.CommitChanges()

Dim newContact As DirectoryEntry = de.Children.Add("CN=New Contact",
"contact")

newContact.CommitChanges()

' Bind to the Computers container and add a new computer.

Dim de01 As New DirectoryEntry("LDAP://CN=Computers,DC=fabrikam,DC=com")

Dim newComputer As DirectoryEntry = de01.Children.Add("CN=New Computer",
"computer")

newComputer.CommitChanges()

Catch Exception1 As Exception

' If a COMException is thrown, then the following code can catch the text of
the error.

' For more information about handling COM exceptions, see Handling Errors.

Dim COMEx As System.Runtime.InteropServices.COMException = CType(Exception1,
System.Runtime.InteropServices.COMException)

Console.WriteLine(COMEx.ErrorCode)

End Try
 
C

Cindy M -WordMVP-

Hi Richb330,
I have got hold of a script from the ms web site that adds an entry into the
active directory.
You need to ask this in a more appropriate newsgroup; this group is specific
for beginner VBA questions for Microsoft Word. You may fit the beginner
category :), about that I don't know, but none of the others, which means it's
unlikely you'll find anyone here who can help you. Unfortunately, I'm not sure
where to send you as this question is so entirely outside my area of expertise.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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

Top