Run to error when using Invoke Code

I run into such error (Invoke Code: Exception has been thrown by the target of an invocation)when i write a code with is to access to all subfolder under inbox before looping with Get outlook Mail Message activities .
image

Maybe other issues are to expect but start with the following correction:

  • use only " for double quotes
  • ensure proper values and do not add space at the end

hi i change all the double quote and input all the right value needed but it still having the same error

show us the corrected Invoke code please

Kindly note:

you can do for analysis reasons:

  • try catch invoke code activity and check the inner exception
  • try catch linewise the critical parts, new App, Folder Access…
  • cross check in an isolated RnD if Folder Access to the input folder is working

image
this the update code .

Hi,

Can you share detailed information of the exception?
We can get it from $exceptionDetails at Locals panel when error occurs in Debug mode.

Regards,


Here information of the exception

Can you share whole content of $exceptionDetails?

Regards,

It seems COM exception regarding folder.
Can you try to identify which line error occurs at?
The following code will help you which line is processed normally.

Console.WriteLine("check point 1")

image
do i add the code like this ? It’s my first time using VBA invoke code .


after i run it i still face the same issue

@xiangyun.koh

Add the console.writeline after every line of code so that from logs we can find which line is failing

Cheerd

this what i get after i add the code after each line

@xiangyun.koh

As per error one of the folder your are searching for is not found…can you please check the same

Also if you check output panel depending on number of writelines you see you can decide which line failed

Cheers