Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6014537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:42:23+00:00 2026-05-23T02:42:23+00:00

I have this code I’m trying to rewrite to c# from a vbs script.

  • 0

I have this code I’m trying to rewrite to c# from a vbs script.

VB has an array function.

So the VB line of code looks like this (In reality it is an LDAP call):

dGrp.Put “ShowInAddressBook”,
Array(“val”, “val”)

I would think the c# equiv would be:

dGrp.GetType().InvokeMember("Put",
InvokeMemberFlags,
null, dGrp, new object[] { "ShowInAddressBook", addressBookvalues.Split(',') });

But this doesn’t work.

I can’t call the PUT method multiple times either, because it overwrites previous values. It’s expecting all the values.

The script works, but the c# produces this:

Unhandled Exception:
System.Reflection.TargetInvocationException:
Exception has been thrown by the
target of an invocation. —>
System.Runtime.InteropServices.
COMException (0x80004005): Unspecified
error (Exception from HRESULT:
0x80004005 (E_FAIL))

Any help would be good, thanks!

EDIT: Sorry for not explicitly mentioning the solution needs to remain COM based. So using managed code alternatives is not an option (in this case).

Binding flags are:

private static BindingFlags setCOMBindings()
        {
            return BindingFlags.DeclaredOnly |
                   BindingFlags.Public |
                   BindingFlags.NonPublic |
                   BindingFlags.Instance |
                   BindingFlags.InvokeMethod;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:42:23+00:00Added an answer on May 23, 2026 at 2:42 am

    I think this was better as a comment but I don’t have enough reputation, so here it goes:

    I’m not familiar with LDAP, therefore I don’t know the objects you’re talking about, but wouldn’t be possible that the problem is the way you’re marshaling the array of values?

    If the method is expecting a VARIANT array, maybe the array of address book values should be an array of object instead of an array of strings.

    Maybe it would be important if someone could get the signature, in COM way, of this Put method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code, which works fine, but I would like to be able
I have this code: if (PsionTeklogix.Keyboard.Keyboard.GetModifierKeyState(Key.Orange) == KeyState.Lock) PsionTeklogix.Keyboard.Keyboard.InjectKeyboardCommand(Function.Orange, 0, 0); if (PsionTeklogix.Keyboard.Keyboard.GetModifierKeyState(Key.Blue) ==
i have this code where you can select the date you like to attend
I have this code, and I'm trying to add a fadeIn once the content.replace
I have this code somewhere in my plugin: $('tr', $this).hover(function(){ var cur_color = null;
I have this code & I've tired using JQuery's appendTo() function to get this
I have this code and I need an explanation on what it does: function
I have this code from a coworker (probably got it from the web somewhere)
I have this code : include(connect.php); // Call database function $p = 100; $sth
I have this code that is captured in the jquery Data object from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.