Outlook and Exchange Server mailboxes problem



I have a problem with reading Exchange mailboxes from Outlook. And for
now I can't fine solution to solve it.

I have like this part of code:

For iCnt = 1 To oNamespace.Folders.Count

Set folder = oNamespace.Folders.Item(iCnt)
EntryID = folder.EntryID
StoreID = folder.StoreID
Path = folder.FolderPath

' Processing other function with current mailbox.


And the problem is that after 200-300 mailboxes, Outlook returns "The
information store could not be opened." error. I have near 1000
mailboxes in my Outlook. All these mailboxes are additional mailboxes
from Exchange Server profile. This error occurs both at Outlook 2003
and Outlook 2007 and with both Exchange server 2003 and Exchange
server 2007.

Also I have tried to do the same using Redemption library through
Redemption.Session and after that try to enumerate through Stores
property, but I have received the same result, first 200-300 mailboxes
are OK and next 700 are return me error.

Could anyone help me with this problem?

Thanks a lot!

Dmitry Streblechenko

Firstly, never use multiple dot notation - the line
is equivalent to

set tempFolders = oNamespace.Folders
tempFolders .Count

where tempFolders is an implicit variable created by the compiler that you
cannot explicitly release.
Secondly, explicitly release all COM objects that you retrive in the loop by
setting them to Nothing:

set tempFolders = Nothing.

If you are using VB.Net, calling Mrashal.ReleaseCOMObject and GC.Collect
would be a good idea.

Dmitry Streblechenko (MVP)
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

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