How to speed up a search on a shared mailbox folder



Hi everybody,

I'm really stuck with the following problem:

Users: Outlook 2003
Server: Exchange 2003

We have to perform searches in a shared mailbox which contains thousends of
emails and look for specifics matches in a custom property ( there is a issue
about this and soon i will write a post just about this)

As a search method i use the restrict method through all the items of a
folder in a shared mailbox. The first time I use the method it takes 40
seconds. Inmediatly subsequent searches take only 1 second. If I search
again about 10 minutes after the first search for this folder i get again the
40 seconds delay where Outlook is like bloqued with that exclamation sign.
Unfortunally this time is not acceptable for us because sometimes we have to
search in a couple of folders. But if i search every 2-3 minutes i never get
this problem, even if a made it for a longer period of 10 minutes.

My questions:

How to maintain the data in a state where the next search is executed "as I
said in one second" even if i didn't search for a while?

Which criteria uses Outlook to decide if a "synchronization" is needed?
After lot of tests i would say 10 minutes is the criteria but sometimes in
searches within 9 minutes this syncronization was executed and sometimes not
even for a longer period of 10 minutes between searches.

Note: I'd like to add that our Internet connection is really fast. I see
changes in this shared mailbox folder made by my colleagues withing 1-2
seconds or even less. Also say that at the moment for this approach a macro
is our solution. Add-In maybe in the future if everything works fine.

Lot of thanks in advance.


Hello Michael,

Thanks for the tips but at the moment I can't follow this way with Redemption.
My IT would never allow me to use a COM object. They don't even let me
install Outlook Spy. And it's a shame because i'd like to explore this way.
My problem is not with the method selbst but with this "requesting data from
server every ... 10 minutes" Solve these Restrict classes this problem for
Outlook 2003 ??

Anyway, as a desperate idea i'm even thinking of perfoming in the background
a silly search every let's say 7 minutes which takes maybe 2-3 seconds so in
the next "real" search we don't spend theses 30-40 seconds

Thanks for your answer, Enrique.

Ken Slovak - [MVP - Outlook]

You're not going to be able to avoid the problem unless you use a MAPI
restriction such as from Extended MAPI or Redemption. Delegate mailboxes are
not cached so any local restriction will only be kept as long as Outlook
decides to keep it, which is not adjustable.

Doing anything on a background thread using the Outlook object model will
end up crashing or hanging Outlook, unless you synch back that thread to the
main thread, which defeats the purpose.

You might want to see if using SetColumns()/ResetColumns() helps, but unless
you end up with Outlook 2007 and its Tables or Redemption and MAPITables or
restrictions I'm afraid you'll just have to live with the problem.


Thanks for your answer Ken.

But now I've got another question. You say that I will have the data as long
as Outlook decides to keep it but i've have made the following tests with
unexpected results:

Client A: Outlook 2003 running a macro.
Client B: Outlook 2003 running the same macro.

Both use the search method (.restrict) on the same shared folder.

00:00 Search with Client A. It takes 40 seconds.
00:08 Search with Client A again. It takes 40 seconds. More or less.
00:09 Search with Client A. It takes 1 second.

That was expected. But:

00:30 Search with Client A. It takes 40 second.
00:31 Search with Client B. It takes 1 second !!!!!

I've have made lot of searches and the tendence remains similar.
So it doesn't depend only of Outlook but also on the server.

I've discard these kind of tricks as you recommended but I'll be happy if
someone could explain this issue. I also found other curious results but
don't want to mention them now to let the thread clear.

Thanks in advance,

Ken Slovak - [MVP - Outlook]

There are a lot of factors that can influence things like how long Outlook
holds references to things: available memory, what and how many other
applications are running, etc. All you can do is optimize your code and live
with that, or investigate other API's that may be faster.

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