Unknown COMexception from Outlook: 0xE0B40219

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

Unknown COMexception from Outlook: 0xE0B40219
Outlook 2003 throws "COMException (0xE0B40219): Unknown Error" 
Ben Empson




Posts: 25
Joined: 2008-08-28
Hi there, I have an Outlook plugin written using the Add-In express architecture. In all my testing I do not have a problem with this plugin, but on a machine at my client's site their Outlook generates the following error:

System.Runtime.InteropServices.COMException (0xE0B40219): Unknown Error.
at Outlook._AppointmentItem.Save()

I can't find any reference to this error anywhere on the web.

My code does the following:


item = (AppointmentItem)outlookApp.CreateItem(OlItemType.olAppointmentItem);
item.AllDayEvent = false;
item.Subject = e.Name;
item.Location = e.Location;
item.Body = e.Description;
UserProperty up = item.UserProperties.Add("UID", OlUserPropertyType.olText, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
up.Value = e.UID;
UserProperty up1 = item.UserProperties.Add("Source", OlUserPropertyType.olText, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
up1.Value = "CleverDiaries";
            
item.MeetingStatus = OlMeetingStatus.olNonMeeting;
item.RequiredAttendees = string.Empty;
item.Save();


Can anyone shed any light on this error?!!

<edit>Further info: it's Outlook 2003 SP3 on XP SP3</edit>

AHA, Ben
Posted 19 Jun, 2009 11:03:39 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Ben,

Does the user have appropriate permissions for that Calendar?


Andrei Smolin
Add-in Express Team Leader

Posted 19 Jun, 2009 12:11:46 Top
Ben Empson




Posts: 25
Joined: 2008-08-28
Hi Andrei, yes they do - 6 or 7 items were previously saved before the one that failed. I'm trying to get hold of the data now to see if it's something in there that maybe caused it...

Cheers, Ben
Posted 19 Jun, 2009 13:24:49 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Ben,

I'd also release all COM object created in your code: item.UserProperties, up, and up1.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Jun, 2009 14:32:25 Top
Ben Empson




Posts: 25
Joined: 2008-08-28
Hi Andrei, yes that's a good idea, I'll try that. The item is specifically released later, I didn't include it above.

FYI, I tested the same data in my Outlook (2007), no problems. I don't imagine that 2003 will make any difference but I'll have to test it on Monday.

Cheers, Ben
Posted 20 Jun, 2009 05:30:42 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Any new?


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2009 08:54:53 Top
Ben Empson




Posts: 25
Joined: 2008-08-28
Hi Andrei, OK I've built a VM with the same specs as my user: XP SP3 and Office 2003 SP3. Works absolutely fine on mine. I also explicitly released the com objects as you suggested - on my VM it worked fine both before and after this change, on the user's machine it made no difference either.

Also, the software is to insert a bunch of appointments in the calendar. On the user's machine every time it manages to do 6 or 7 then fails with this error. Again, the exact same data on my VM is fine.

The only major difference I know of between our machine is that theirs is Exchange connected, while my VM is running off a personal PST. Do you think this could make a difference?

Cheers, Ben
Posted 22 Jun, 2009 14:26:26 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Ben,

This is a really big difference. Also make sure that you use Exchange in the same mode as the user: see the Use Cached Exchange Mode checkbox in the Exchange account settings.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2009 14:49:44 Top
Ben Empson




Posts: 25
Joined: 2008-08-28
Hmm, can you point me at any docs where I can find out what mode they're in and how to use the same?

FYI: my users could be Exchange connected or not. I'll have to detect and configure this on the fly.

Cheers, Ben
Posted 22 Jun, 2009 14:55:32 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Ben,

The mode is determined by the state of the checkbox below:

User added an image

If you use Outlook 2007, you can check Namespace.ExchangeConnectionMode. There is no sure way to find this in previous Outlook versions.


Andrei Smolin
Add-in Express Team Leader
Posted 23 Jun, 2009 07:27:44 Top