Outlook becomes unstable after reading 100ths of calendar items

N

Nico De Greef

Hi,

I'm developing a C# application to read out Outlook calendar items in
Outlook 2003.
The calendar is stored in a Microsoft Exchange 2003 mailbox.

The application works perfectly when reading a few items.
After reading 100ths of calendar items Outlook and the reader application
become unstable raising several error messages when opening items.

At the same time exchange logs a 'too many sessions' error which seems to be
a self-protection action if a session starts to consume too many server
resources.

My guess is that the opened outlook calendar items are garbage collected too
late, causing the error, but even forced garbage collection does not solve
the problem.

This is becoming a time-critical issue since the deadline is approaching.

Best regards,
 
N

Nico De Greef

This simplified code which causes the error(s):
Outlook.ApplicationClass oApp = new Outlook.ApplicationClass();
Outlook.MAPIFolder oFolder =
oApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

foreach(object oItem in oFolder.Items)
{
if (!(oItem is Outlook.AppointmentItem))
{
continue;
}
}
<<<

Normally the calendar folder should contain AppointmentItems only but on
some items a specified Cast invalid occurs anyway.

The above code works fine for a few items, but after working with a calendar
with 1000 appointment items outlook generates 'unknown error' codes when
saving new appointments in outlook.
 

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