JL.
JL.

Reputation: 81342

Which DLL do I need to reference for an LDAP COM object?

I know it's a bit old school, but I have to translate an LDAP function written in VB (Visual Basic not .net). And using managed code I can't produce the same result.

To solve the problem quickly I would like to use COM (Component Object Model) exactly as the Visual Basic function is doing like this:

set dso=GetObject("LDAP:")

I'm completely out of practice with COM, what DLL would I need to include as a reference to make it work?

Upvotes: 0

Views: 358

Answers (1)

joncham
joncham

Reputation: 1614

I believe Marshal.GetActiveObject is the equivalent to the VB GetObject call you are used to using.

This will return you the object, you then need to either:

  1. Reference an interop assembly with the type definitions for your LDAP object
  2. Make the calls to the object using reflection invoke
  3. Use the dynamic keyword in C# 4.0 to make the calls to the object using a late bound mechanism, similar to what VB did

I recommend using option 3 if you are using .Net 4.0

Upvotes: 1

Related Questions