how to add more then 250 contacts?

  • Thread starter Thread starter Sam Jost
  • Start date Start date
S

Sam Jost

Hi!

I'm adding contacts to a public folder in outlook/exchange 2003.

This does work well enough for the first 250 contacts, then I get an error
log entry stating there is a limit of 250 open MAPI objects so I can't add
more.

I can work around this by closing my connection after adding 250 items, but
ain't there some better way to do this?

Thanks,
Sam
 
If you don't mind my source being c# I'm happy to. I simplified it a bit, it
won't compile, but it shows everything I do with outlook:

Outlook.Application outlookApp = new Outlook.Application();
Outlook.NameSpace outlookNamespace = outlookApp.GetNamespace("mapi");
outlookNamespace.Logon("SR", "", true, true);
outlookKontaktFolder = outlookNamespace.PickFolder();
foreach (KdInfo kd in Kunden.Values)
{
Outlook.ContactItem newItem =
(Outlook.ContactItem)outlookKontaktFolder.Items.Add("IPM.Contact");
newItem.LastName= kd.LastName;
newItem.Close(Outlook.OlInspectorClose.olSave); //<- crashes after 250
calls
}


the program crashes after 250 Close calls. I can replace newItem.Close(...)
with newItem.Save(), it will crash after 250 calls too (even if I remove the
call it will crash after 250, only at some other location).

The crash writes an log entry on the exchange server:

MSExchangeIS 9646 21.12.2004 11:16 2 *
Closing Mapi session "/o=B-SOFT2/ou=first administrative
group/cn=Recipients/cn=Sam.Jost" because it exceeded the maximum of 250
objects of type "objtMessage".

any ideas how to dispose of the added objects so they will be saved to the
server folder?

thanks,
Sam
 
When you import data from csv (or some other storage) with Outlook it does
not hit this 250 boundary, so I'm quite sure there must be a better way to
work around this limitation then changing the registry on every comp.

How does MS do it?

Sam
 
Problem solved. I just needed to properly dispose the com objects using
ReleaseComObject and everything did work.

So there is no issue in MS software, just the documentation for this case
could be better.

Sam
 
Back
Top