.NET Calls to Outlook calls fail after a period of time????

S

Shawn Anderson

I am looking to see if anyone else is experiencing the same issues that I
am. I have an application that is using c# to access Outlook 2003 using the
interop libraries. Everything is great until I start accessing a large
number of folders/messages. Then all of a sudden I get "Unknown COM errors"
evertime I try to access a property or cast an object. The only way I have
found to fix this is to kill the outlook.exe process and start over.

A little background:
I am creating an application to run reports on incoming/outgoing email
based on time, sent to, sent from, etc. So I need to access several hundred
folders accross about 10 mail boxes, each containing potentially hundreds to
thousands of emails.

Any anyone offer some help or advice on this issue or on a better way to do
it then the interop libraries?

Thanks
Shawn
 
D

Dmitry Streblechenko \(MVP\)

Most likely you are hitting a well known .Net/Windows problem - there is a
255 RPC channels/process limit in Windows. Every message or folder in
Exchange opens an RPC channel when initialized. Since .Net (Garbage
Collector to be precise) releases COM objects whenever it feels like it, it
is easy to hit the 255 channels limit. Release all COM objects explicitly
using Marshal.ReleaseCOMObject instead of setting them to NULL.


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
S

Shawn Anderson

I knew there had to be something like that. Is there a KB article on this?

Thanks for the help.
 

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