NewMail Event

D

demon

Hi,

Im looking to read information from emails as they come into the inbox using
the itemadd event, however if the user has to click yes on the security
prompt emails are missed.

To try to combat this, i want to store the entry ID, and then when the send
and receive is finished i can then use that entryid (unique) to access the
email, where it doesnt matter if the prompt is not clicked immediately.

However what im struggling to do is capture when the send and receive event
has finished. The newmail event seemed perfect as it is supposed to be
called only once, however testing shows that the newmail event is in fact
called every time a new email is received.

Any ideas anyone ?

Thanks,

Leon Pinkney
 
K

Ken Slovak - [MVP - Outlook]

There is no event for ending a send/receive unless it's initiated by code.
Then you can use the SyncEnd event of the SyncObject. That doesn't work if
the send/receive is initiated manually or automatically by the user.

NewMail fires only at intervals, not for every new mail that comes in.

There should be no reason for the security prompts to appear unless your
code is accessing secure properties or methods. In that case you can use the
Exchange security form to permit those accesses if you are using Exchange or
you might want to code those accesses using Redemption
(www.dimastr.com/redemption) to avoid them.
 
D

demon

Thanks for the advice.

I dont think I really explained things very well - and the end result has in
fact now changed also!

To simplify things, what im looking to do is capture the entryID of each
email that comes in, and once all emails are in, fire another function which
will evaluate the emails just received, and creates an XML file of details
and attachments binary data so that it can be uploaded. At the moment the
creation of the XML file is a problem due to time, on large files (250KB+)
the binary data isnt being fully created whilst being used on the AddItem
event.

Make sense ?

Thanks for your help,

Leon Pinkney
 
K

Ken Slovak - [MVP - Outlook]

Sorry for the delay in answering, I lost power in the recent hurricane.

I'd use the ItemAdd method for the Items collection of the Inbox. That fires
for each item that comes in and has an Item argument you can use to get the
EntryID of each item. Add that to a collection and when you handle the
collection at a later time remove the now used reference from the collection
so you don't handle it more than once.

One thing to be aware of is that EntryID can change if the item is moved to
another folder or deleted. So any rules that might move an item would screw
up this system.
 

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