"The operation failed. An object could not be found" when Add-in L

G

Guest

Hi,
a few of our users are reporting an error when Outlook starts (when the
add-in loads).
Error: "The operation failed. An object could not be found."

I can't simulate this error on my development machine and not all users are
experiencing this problem. The problem is also not constantly emerging. Most
of the users who experience it can resolve it ... temporarily... when they
reboot their computer. But for a minority, even this doesn't help.

The error is located in the code which I execute to wire all the events when
the add-in loads:

internal void InitHandler(Outlook.Application oApp)
{
try
{
_objBusiness.Application = oApp; //Application object
_olNS = _objBusiness.Application.GetNamespace("MAPI");

_objBusiness.Application.NewMailEx += new
Outlook.ApplicationEvents_11_NewMailExEventHandler(this.Application_NewMailEx);
_objBusiness.Application.ItemSend += new
Outlook.ApplicationEvents_11_ItemSendEventHandler(this.Application_ItemSend);

_colInboxItems =
_olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Items;

SetCalendarEvents();

_colContacts =
_olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts).Items;

_colTasks =
_olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks).Items;
_colTasks.ItemAdd += new
Outlook.ItemsEvents_ItemAddEventHandler(this.Tasks_ItemAdd);
_colTasks.ItemChange += new
Outlook.ItemsEvents_ItemChangeEventHandler(this.Tasks_ItemChange);
_colReminders = _objBusiness.Application.Reminders;
_colReminders.ReminderFire += new
Outlook.ReminderCollectionEvents_ReminderFireEventHandler(this.Reminders_ReminderFire);

_olExplorer = _objBusiness.Application.ActiveExplorer();
_eExplorer = (Outlook.ExplorerEvents_10_Event)_olExplorer;
_eExplorer.Close += new
Outlook.ExplorerEvents_10_CloseEventHandler(this.Explorer_Close);

_objBusiness.ProcessInbox(_colInboxItems, _colContacts);
}
catch (SystemException ex)
{
DebugLog.Write("InitHandler", "Exception: " + ex.Message);
}
}

I suspect the error to occur on the line where _colContacts is instantiated
because another error is logged when the add-in tries to use this object.

Anyone an idea of a possible cause?
I'm using Visual Studio 2003, Office 2003 and the Office 2003 PIA which is
distributed in the installation.
 

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