NewMailEx

Add-in Express™ Support Service
That's what is more important than anything else

NewMailEx
 
Rup Go




Posts: 64
Joined: 2007-03-01
Hi,

why does my NewMailEx only gets the 1st new mail received, MessageBox just pops up once even if more than 1 mail arrived at the same time when user press send/receive mail. thanks!!

here is my code

private void adxOutlookEvents_NewMailEx(object sender, string entryIDCollection)
{
object obj = null;
Outlook.MailItem mail = null;
Outlook._NameSpace ns = null;

try
{
ns = OutlookApp.GetNamespace("MAPI");
string[] ids = entryIDCollection.Split(',');
//MessageBox.Show(entryIDCollection.ToString());
for (int i = 0; i < ids.Length; i++)
{
obj = null;
try
{
obj = ns.GetItemFromID(ids[i], Type.Missing);
if (obj is Outlook.MailItem)
{
mail = obj as Outlook.MailItem;
MessageBox.Show(mail.Subject);
}
}
finally
{
if (obj != null)
Marshal.ReleaseComObject(obj);
}
}
}
finally
{
if (ns != null)
Marshal.ReleaseComObject(ns);
}
}
Posted 16 Apr, 2007 01:44:30 Top
Rup Go




Posts: 64
Joined: 2007-03-01
by the way im using Outlook 2003
Posted 16 Apr, 2007 01:45:00 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Rup.

The code in the NewMailEx event handler should work as fast as possible.
Please don't use the MessageBox class to determine the number of incoming emails. In fact the event fires for all emails.



P.S. Note that we take up your forum requests in the order we receive them. Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 16 Apr, 2007 08:07:04 Top
Rup Go




Posts: 64
Joined: 2007-03-01
Hi Sergey,

string[] ids = entryIDCollection.Split(','); in my code got only 1 item even if i got 3 new mails, NewMailEx entryIDCollection paramater only have one, the 1st one? i think this isn't the MessageBox problem but maybe my code lacks something? thanks

here is what i exactly did,

-send/receive button clicked
-got 3 new mail
-have a string who collects all subject
-finally prints out the subject/s

unfortunately it only got the 1st mail's subject

thanks
Posted 17 Apr, 2007 00:03:51 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Rup.

Please try to use the ADXMAPIStoreAccessor component. Using the component you will able to track all emails in the VS debugger.
http://www.add-in-express.com/projects/adx-mapi-store-accessor.msi

Posted 18 Apr, 2007 10:17:21 Top