Invoke Code with pipe character

Hi everyone!

I am having trouble when trying to invoke an API through Invoke Code with VB. The thing is: I have an example of the API I have to use, BUT, when replicating it, UiPath says I have a character that doesn’t “belong” there. Here is a snippet of the API invocation:

MethodInfo priMethod = httpWebRequest.Headers.GetType().GetMethod(“AddWithoutValidate”, BindingFlags.Instance | BindingFlags.NonPublic)

I have had to change it a little bit for UiPath to recognize the code. It is like this:

Dim priMethod As MethodInfo = httpWebRequest.Headers.GetType().GetMethod(“AddWithoutValidate”, BindingFlags.Instance | BindingFlags.NonPublic)

But UiPath throws an error because the pipe character is not valid, but I don’t know what to do. I have seen the pipe character is like an enumeration, like it has to be both BindingFlags, not just one, but nothing has worked.

Do you know what could I use for this code to work?

Thank you everyone.

Hi @angelmonrealr

Could you try this one?

Dim priMethod As MethodInfo = httpWebRequest.Headers.GetType().GetMethod("AddWithoutValidate", BindingFlags.Instance Or BindingFlags.NonPublic)

Cheers

Hi Henrique,

This is the first time I have used VB code, so sorry for my ignorance. I have researched and I have seen this post on Google:

So, I assume “OR” doesn’t match here. It has to be both options, not just the first OR the second, but both.