@Yini Zhang,
One of the easiest ways to debug Code stages is to use the .NET MesageBox object. That gives you the ability to pop-up a dialog where you can add information to give you an idea how things are progressing in your code, what paths the code takes, etc. To do this, you need to add a DLL reference and a namespace reference in the Code Options of the VBO Properties.
Open the Outlook VBO and then on the Initialize tab double click on the Note stage. This will bring up the VBO Properties dialog.
Click on the
Code Options tab. Under the
External References section, add the following DLL:
System.Windows.Forms.dll. Under the
Namespace Imports section, add the following namespace entry:
System.Windows.Forms. It should look something like this when you're done:
Once you've done that, you now have access to the .NET MessageBox object. On the
Global Code tab you can now add calls to
MessageBox.Show() to help us understand where things are going awry. Here's an example:
Here's what it will look like as you step through the process:
WARNING: Make sure you go back and remove all of the MessageBox entries before trying to run the process in production. Otherwise, your process will stop at each MessageBox.Show call and wait for someone to dismiss the messagebox by clicking the OK button.
Cheers,
Eric