Any event when Receiving tasks complet?

I

iammark

Hi,

I am play VBA in Microsoft Outlook.
Do you know how to fire an event when the Receiving tasks complet?

Thank you in advance.
 
K

Ken Slovak - [MVP - Outlook]

The PropertyChange event should fire in that case. The input argument for
that event will tell you what property was changed.

Or do you mean when the Inbox receives a complete notification for an
assigned task? In that case you would receive an ItemAdd event on the Items
collection of the Inbox.
 
I

iammark

Thank you for your quick response.

In fact, I need to do deal with every new email. I have tried the
ItemAdd event. The problem is when receiving more than one email, only
one event fired.
Now, I am trying only to record new email items in the ItemAdd event
without doing anything, until the Receiving tasks complet, then I will
deal with all the new emails....
Can I do that?
 
K

Ken Slovak - [MVP - Outlook]

ItemAdd will fire unless you get more than about 16 items at a time.
Otherwise it's a question of your event handler taking too much time and
therefore missing the following event.

Is this Outlook 2003 VBA? If so you could use the Application.NewMailEx
event which passes an array of EntryID's for each new item. You can parse
the array and use NameSpace.GetItemFromID to get those items using the
EntryID's.
 
I

iammark

Yes, I need to deal with the new email and it must take too much time!!
I am using Outlook 2000 :(
Any event will be fired when Outlook finished receiving the new emails?
 
K

Ken Slovak - [MVP - Outlook]

No. The NewMail event only fires every so often and can't be depended on at
all. ItemAdd is your only option with Outlook 2000.

Just set up in your ItemAdd handler enough information stored in a
collection or something so you can later process the items. Then set up a
call-back to do the processing after you exit ItemAdd. A timer would do the
trick. When the timer fires you process each item in the collection. If
ItemAdd fires again you're not in that interrupt handler so it won't be
blocked.
 
I

iammark

Thank you. It looks not so easy :(

Is there any event we can use just before Outlook finishes
"Send/Receive" for one folder or finishes the whole proccess?

The "Timer" you mentioned is an API timere or available in Outlook VBA?
 
I

iammark

Thank you. It looks not so easy :(

Is there any event we can use just before Outlook finishes
"Send/Receive" for one folder or finishes the whole proccess?

The "Timer" you mentioned is an API timere or available in Outlook VBA?
 
K

Ken Slovak - [MVP - Outlook]

No, there's no way at all to tell that. You can get an event for SyncObjects
ending if you initiate the sync (send/receive) using code but not if the
user starts the cycle.

I usually use a Win32 API timer.
 
G

Guest

Hey,

I've been searching the web for this exact issue and I can't get things to
work. My scenario is very similar. My ISP uses something called SpamAssasin,
I have configured it to prefix the header of every spam mail with the spam
hit points and then ***SPAM*** to easily identify it as spam.

Then I've created an outlook rule which moves all mail with ***SPAM*** in
header to my Junk E-Mail Folder. Then I created a rather simple macro which
runs through all the jun e-mail and deletes all mail with spam hit points
above 10 points because that mail is most definetly spam. Then I manually
check the remaining mail with hit points less than 10 to make sure it really
is spam. All of this works fine except with the outrageous ammounts of spam
that my company receives, any and all automation I can do is very helpfull.

I would like to have my code run automatically after receiving mail. It
doesn't really make any difference if it waits until all mail has been
received and then executes or if it executes for each mail, but I would tend
to think that the first option is the fastest.

The way I see I have three ways of accomplishing this:
1. I create a custom button which executes a send and receive and then runs
my spam killing macro.

2. I place code somewhere so that my macro will run after the send/receive
event (syncEnd? event?) has fired.

3. I rewrite my code to check every incoming mail by using the ItemAdd or
MailNewEx.

Can someone please explain to me how to accomplish this?

Thank you very much in advance.
Murple
 

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