I am doing a Add-In for OUTLOOK by C Sharp, but i am getting trouble with a
quite weird problem.
actually, i wish to save the mail details when one mail sent.. but when i
make use of the save methods, which just execute once. Therefore, i use
messageBox to test it. It is quite amazing that sometimes it just execute
twice(Testing CASE1, see following code), sometimes it run three
times(Testing CASE2). However, if i just use messageBox, do not make use of
any other functions and methods, it's right..
I do not where is wrong??? and how to solve it???? I really need your help,
due to this is my final year project, which is so crucial for me!!! MANY
I really appreciate any help if anyone give to me....
the following are my codes:
public void OnStartupComplete(ref System.Array custom)
sentFolder = outlookNS.GetDefaultFolder(OlDefaultFolders.olFolderSentMail);
private void sentFolder_ItemAdd(object Ctrl)
MessageBox.Show("Sent Folder Testing1");
Microsoft.Office.Interop.Outlook.MailItem mailItem =
MessageBox.Show("Sent Folder Testing2");
// Testing CASE1: which just execute twice to disply the testing messages,
in the third time, there is nothing to show
IDictionaryEnumerator enumerator = mail_table.GetEnumerator();
Microsoft.Office.Interop.Outlook.MailItem item =
MessageBox.Show(item.SentOn.ToString()+ item.Recipients.Count.ToString() +
//Testing CASE2: the following execute three times to disply the testing
message, there is nothing to show in the fourth time.
//MessageBox.Show(mailItem.SentOn.ToString() + mailItem.Subject);
//MessageBox.Show("Sent Folder Testing3");