• Subject: to many open objects
  • Author: Anonymous
  • Date: 04 May 2010
  • References:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Outlook;
namespace PrintContacts
{
class Program
{
static void Main(string[] args)
{
Application outlook = new Application();
NameSpace ns = outlook.GetNamespace("MAPI");
MAPIFolder cf = ns.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
foreach (object o in cf.Items)
{
if ((o as ContactItem) != null)
{
ContactItem ci = (ContactItem)o;
Console.WriteLine(ci.FullName);
}
}
}
}
}

--> After listed about hundred contacts I get the error:
System.Runtime.InteropServices.COMException (0xB5940305): [localized
message - something like "to many open objects on the exchange server"].
vid Microsoft.Office.Interop.Outlook._ContactItem.get_FullName()
vid PrintContacts.Program.Main(String[] args) i
C:\PrintContacts\Program.cs

How can I prevent this?
04 May 2010to many open objects.Anonymous
04 May 2010|- Re: to many open objects.Brian Tillman [MVP-Ou...
04 May 2010\ Re: to many open objects.Ken Slovak - [MVP - O...
05 May 2010   \ Re: to many open objects.Anonymous
05 May 2010      \ Re: to many open objects.Ken Slovak - [MVP - O...
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)