Add-in Express™ Support Service
That's what is more important than anything else

Rick Koch

Posts: 172
Joined: 2006-09-05
I'm using VS2005, the ADX VSTO product, and OL2003.

I've written a tiny winapp that should open Outlook via automation, create an appointment, and display the appointment inspector.

In Outlook, we're building a pretty robust add-in that responds to events on items having custom properties, synchronizing Outlook data to our business app through (local) remoting. The above appointment has such a custom property, and it's our intention to process it through the addin when the user saves it.

When I run the app with Outlook shutdown, it correctly starts Outlook UNLESS the ADX addin is installed. If the addin is installed, I get this exception:

Error occured in the code of Add-in Express .NET (MS Office) library. See 'Details' section to get more detailed information about the error.

Detailed technical information follows:
Date and Time: 11/4/2006 7:47:29 PM
Machine Name: JAXNBXP086
IP Address: xxx.xxx.xx.xx
Current User: xxxxxxx\rkoch

Application Domain: MPS.Cosmos.OfficeIntegration.OutlookAddin.dll.manifest
Assembly Codebase: file:///C:/WINDOWS/assembly/GAC_MSIL/AddinExpress.VSTO/2.6.2388.0__2b3662baf831494c/AddinExpress.VSTO.dll
Assembly Full Name: AddinExpress.VSTO, Version=2.6.2388.0, Culture=neutral, PublicKeyToken=2b3662baf831494c
Assembly Version: 2.6.2388.0
Assembly Build Date: 10/9/2006 2:50:54 PM

Exception Source:
Exception Type: System.Runtime.InteropServices.COMException
Exception Message: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
Exception Target Site: ForwardCallToInvokeMember

---- Stack Trace ----
System.RuntimeType.ForwardCallToInvokeMember(memberName As String, flags As BindingFlags, target As Object, aWrapperTypes As Int32[], msgData As MessageData&)
AddinExpress.VSTO.dll: N 0195 (0xC3) IL
AddinExpress.VSTO.ICOMAddIn.set_Object(value As Object)
AddinExpress.VSTO.dll: N 00000 (0x0) JIT
AddinExpress.VSTO.dll: N 0108 (0x6C) IL
AddinExpress.VSTO.dll: N 0441 (0x1B9) IL

This is the code that launches Outlook:

private void button1_Click(object sender, EventArgs e)
outlookApp = new Outlook.Application();
mapi = outlookApp.GetNamespace("MAPI");
appointmentsFolder = mapi.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
appt = (Outlook.AppointmentItem)outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
cosmosProfile = appt.UserProperties.Add("CosmosAppointmentProfile", Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText, true, Type.Missing);
cosmosProfile.Value = textBox1.Text;
appt.Body = textBox2.Text + "(-*-*Do not change this line. Notes below will be displayed in COSMOS.*-*-)\n";
insp = appt.GetInspector;

insp = null;
cosmosProfile = null;
appt = null;
appointmentsFolder = null;
mapi = null;
outlookApp = null;

Note that if I attempt to create the appointment through automation with Outlook and the addin already running, it works fine (so I can't see the source of the exception in the debugger). It also works fine if I try to automate the appointment creation with the addin disabled. In short, it only fails if Outlook is not running and the addin is enabled. In this case, after the exception disables the addin Outlook creates the appointment normally.
Posted 04 Nov, 2006 19:57:47 Top
Sergey Grischenko

Add-in Express team

Posts: 7233
Joined: 2004-07-05
Hi Rick.

We have just published a new version of the product. Please download it.
Let me know if the issue still exists.
Posted 06 Nov, 2006 12:18:46 Top
Rick Koch

Posts: 172
Joined: 2006-09-05
It's still happening intermittently. Alternately, the exceptions come from one of my startup routines, where I get a COM object cast error in code that works perfectly when the user starts Outlook.

I've experimented with the System.Diagnostics.Process component. If I start an Outlook process before creating my Outlook.Application, it appears to start the addin correctly. I'm thinking about doing that as a workaround. What do you think?
Posted 06 Nov, 2006 18:07:41 Top
Sergey Grischenko

Add-in Express team

Posts: 7233
Joined: 2004-07-05
Hi Rick.

Does the error appear if you comment all startup code in your add-in?
Can I test your project on my PC?
Posted 07 Nov, 2006 05:49:19 Top
Sergey Grischenko

Add-in Express team

Posts: 7233
Joined: 2004-07-05
Rick, one more question.
Do you have both OL2003 and OL2007 installed on one PC?
Posted 07 Nov, 2006 05:58:29 Top