A
Anker Berg-Sonne
I use C# and Interop to automate Outlook. It works fine,
except when I access a large number of items I get an out
of memory error. The code is simple:
using MSOutlook=Microsoft.Office.Interop.Outlook;
Outlook=new MSOutlook.Application();
MSOutlook.NameSpace NameSpace=Outlook.GetNamespace("MAPI");
and then the offending snippet:
MSOutlook.MailItem MailItem=NameSpace.GetItemFromID
(ThisItem.ID,ThisItem.StoreID) as MSOutlook.MailItem;
if (MailItem==null)
{
...
}
else
MailItem.Close(0);
The snippet is inside a loop that checks whether Items
that I have registered in my code still exist in Outlook.
If I have a large number of items registered in my
application it eventually fails with an out of COM memory
error.
TIA/Anker
except when I access a large number of items I get an out
of memory error. The code is simple:
using MSOutlook=Microsoft.Office.Interop.Outlook;
Outlook=new MSOutlook.Application();
MSOutlook.NameSpace NameSpace=Outlook.GetNamespace("MAPI");
and then the offending snippet:
MSOutlook.MailItem MailItem=NameSpace.GetItemFromID
(ThisItem.ID,ThisItem.StoreID) as MSOutlook.MailItem;
if (MailItem==null)
{
...
}
else
MailItem.Close(0);
The snippet is inside a loop that checks whether Items
that I have registered in my code still exist in Outlook.
If I have a large number of items registered in my
application it eventually fails with an out of COM memory
error.
TIA/Anker