Problem with DirectoryEntry.Invoke method

  • Thread starter Thread starter Walter Zydhek
  • Start date Start date
W

Walter Zydhek

Can anyone help with the use of the Invoke method of a
Directory Entry object? I am using vb.net.

I am trying to invoke the get_Filter method of the
IIS://LocalHost directory entry, and get the following
error: System.Reflection.TargetInvocationException

MSDN Library shows the following for the get_Filter method:

HRESULT get_Filter
([out] VARIANT *pvFilter);

I imagine the problem I am having is the [out] variable.
Do I need to somehow pass a reference to a variable?

Any help would be appreciated.
 
Can anyone help with the use of the Invoke method of a
Directory Entry object? I am using vb.net.

I am trying to invoke the get_Filter method of the
IIS://LocalHost directory entry, and get the following
error: System.Reflection.TargetInvocationException

Well, you could always add a reference to the COM ActiveDS Type
Library to your project, and then grab the "AD native object" like
this (C# - should be easy to translate to VB.NET) :

ActiveDs.IADs oNative = (<your DirectoryEntry>.NativeObject as
ActiveDs.IADs);

Then you should be able to call get_Filter directly:

oNative.get_Filter .........

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
-----Original Message-----

Well, you could always add a reference to the COM ActiveDS Type
Library to your project, and then grab the "AD native object" like
this (C# - should be easy to translate to VB.NET) :

ActiveDs.IADs oNative = (<your
DirectoryEntry>.NativeObject as
ActiveDs.IADs);

Then you should be able to call get_Filter directly:

oNative.get_Filter .........

Marc
========================================================== ======
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at) inova.ch
.

I tried doing as you suggested, but get a "Public
member 'get_Filter' on type '_ComObject' not found" error.

If I uss oNative.Filter instead, then I get a
"System.NotImplementedException" error instead.

-Walt
 
I tried doing as you suggested, but get a "Public
member 'get_Filter' on type '_ComObject' not found" error.

If I uss oNative.Filter instead, then I get a
"System.NotImplementedException" error instead.

Well, maybe you'll need to use some more specific interface, like
IADsUser instead of just the generic IADs - read the MSDN docs for
details.

Marc
 
Try:

ActiveDs.IADsContainer oNative = (<your DirectoryEntry>.NativeObject
as ActiveDs.IADsContainer);

Then you should be able to access the "Filter":

oNative.Filter .........


Marc
 
Back
Top