Exchange 250 open objMessage limit

  • Thread starter Thread starter bevan.johnson
  • Start date Start date
B

bevan.johnson

I have read about this problem all over the forums, but have not come
across any answers yet.

I am creating MailItem objects within a VSTO C# Outlook add-in,
specifically in the SelectionChange event. This is to allow some
interigation of the selected mailItem. The problem I am facing is that
every time the event fires and a MailItem object is created, the "Open
Messages" count for that user increases by 1 on exchange. Fair enough,
but I cannot get the count to decrease when I move to the next
mailitem. I have tried:

Marshal.ReleaseComObject(myMail)
myMail.Close("with appropriate switch")
myMail = null

None of these seem to destroy the object and decrease the count. If I
cannot solve this problem, my whole project dissappears down the
plughole and I will be forced to buy "Off the shelf" Arrrghh.

Please help me, and thanks in advance.

Bev.
 
Can you change the limit on the server? It's a registry entry.

If not, make sure you don't use multiple dot operators but assign everything
explicitly to objects where needed. Release all those. Call the garbage
collector and wait for it to complete. Make sure you don't have any
persistent references to anything.
 
Ken,

Thanks for the blisteringly fast reply.

I forgot to mention that raising the limit was not an option. But that
is irellevent now as forcing the GC did the trick. So simple, yet these
things often ellude us.

You are a god amongst MVPs.

Thanks again,

Bev.
 
Back
Top