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);
}
} |
|
Rup Go
Posts: 64
Joined: 2007-03-01
|
by the way im using Outlook 2003 |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
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. |
|
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 |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
|