olApplication_NewMail()

L

LBT

I'm fairly sure that I read somewhere on MS that the olApplication_NewMail()
event does not fire on all new mail. I need to know when a new mail item is
recieved to do some processing. It this event is not reliable what else can
I do? Also is there any way of getting in ID for the newmail event ?
Any help would be great
Christopher Brown
 
S

Sue Mosher [MVP]

That is correct. Outlook 2003 includes a NewMailEx event that is supposed to pass a string that comprises a collection of EntryIDs, but I've had mixed results with it so far. You can also use Redemption (http://www.dimastr.com/redemption/) which has a more robust event for handling the individual new item.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
M

Michael King

I'm curious how a new email has an EntryID. I have always saved the mail to
the draft folder in order to get an EntryID. Is it possible to get the
EntryID for a new mailitem in Outlook 2002 and 2000?

Thanks,

Michael

That is correct. Outlook 2003 includes a NewMailEx event that is supposed to
pass a string that comprises a collection of EntryIDs, but I've had mixed
results with it so far. You can also use Redemption
(http://www.dimastr.com/redemption/) which has a more robust event for
handling the individual new item.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP]

Outlook 2003 assigns one. In Outlook 2002 or 2000, you can do as you're doing now -- save the item to get an EntryID.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
M

Michael King

Thanks Sue. Maybe you can answer another question that has confused me for
a while.

I have an addin that catches outgoing messages and converts office documents
to html, removes the original attachment and attaches the coverted html.
Before I do the conversion I call Item.Save to make sure I can leave a valid
email in the draft folder if something crashes. In Outlook XP if there are
non-office documents attached after office documents (i.e. a .doc then a
..txt) when I make the call to delete the old attachments I get an "Object
required" error. I have debugged it to the point that I know that using
save (either manually or programatically) before doing the deletes causes
the error message.

In my debugging I noticed that saving the message manually results in the
attachments being reordered placing the office documents at the end of the
list of attachments. To see this you have to close the in-progress email
and reopen it from the drafts folder. With the documents in this order
(non-office docs first, office docs last) everything works fine.

Note that I am seeing this behavior only in 2002/XP and not in 2003 or 2000
and that the bug occurs before any of the conversion takes place.

I can post some code if someone wants to take a crack at it.

I can reproduce the problem on any Windows OS running Outlook XP (latest SP,
security patches, etc), Outlook or Word as editor.

Thanks again,

Mike

Outlook 2003 assigns one. In Outlook 2002 or 2000, you can do as you're
doing now -- save the item to get an EntryID.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP]

A simple code sample that reproduces the problem would give Microsoft something to look at. Post under a new thread, though, please.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
M

Michael King

I started a new thread under "Error when saving MailItem or deleting
Attachment". I included some example code and steps to reproduce the
problem.

Any help would be appreciated.

Thanks,
Michael

A simple code sample that reproduces the problem would give Microsoft
something to look at. Post under a new thread, though, please.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top