Determine Outlook2003 Folder Update complete?

J

Jim Leach

I've written a COM Addin for Outlook in VB that displays a dialog whenever an
item is added to the Sent Items folder. All is well except when running
Outlook2003 in Cached Mode. When Outlook is started and the Sent Items folder
is updated, the dialog is displayed for every "new" item in the folder. I've
tried trapping all of the SyncObjects when my addin is loading but they do
not seem to be firing during this initial Update process. I need some way to
determine when this initial "folder update on startup" is complete so that I
can "disable" my addin until it is finished.
Any help greatly appreciated,

Jim
 
K

Ken Slovak - [MVP - Outlook]

The SyncObjects events won't fire unless the synch was started from your
code. The automatic synchs don't do that. On_StartupComplete isn't a good
indicator either.

There really isn't a good answer for this. You can check
NameSpace.ExchangeConnectionMode to see when the connection state goes to
one of the cached settings but the synch could still be going on then,
especially over a slow connection to Exchange (think VPN say). Also, when
using cached mode with Exchange 5.5 you get ExchangeConnectionMode =
NoExchange.

I would check ExchangeConnectionMode and throw in a timer that starts then
and maybe set it to a few seconds and see how that works out. You can always
adjust the timer setting.
 
J

Jim Leach

Thanks for the reply Ken, unfortunately you have confirmed my suspicions.

I tried forcing the SyncObjects to fire on Startup and bypassing my
_ItemsAdd() code while they were still "InProgress" which worked well. Sadly
it turns out that
running in Cached Mode and performing a Send/Reply/Forward fires the
SyncObject
as well and my SentItems_ItemsAdd() code gets bypassed again!

I think the solution may be to trap the Application.ItemSend event and do
what I
need to there - this completely eliminates the Cached Mode/startup/synching
issue
but it has a couple of issues of its own but they are coding issues such as
changing
my Global Outlook Application object to a local object to declare it
"WithEvents".

Thanks again,

Jim
 

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