Two Questions: Outlook Data Files and folder selection

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

Two Questions: Outlook Data Files and folder selection
 
Chris Losinger




Posts: 4
Joined: 2008-11-12
We have an Outlook add-in, written with AddInExpress .Net 2008 v4.3. Recently, we've seen two things which are giving us some concern:

1. From time to time, Outlook will apparently fail to close properly, and will complain about unclosed data files, the next time it starts. Is this something we're causing? Is there anything in Add-in Express or the Outlook object model that we're doing (or not doing) which would cause this? I've triple-checked all of the Outlook._MailItem.UserProperties and Outlook._Explorer.Selection[x] objects to make sure we're calling ReleaseComObject when we're done... but it still happens.

2. When the addin is enabled, Outlook's Mail Folders pane apparently gets confused and starts forgetting to erase selection rectangles on folders: click a folder, Outlook draws a blue (or sometimes gray?) selection rect around the folder. Click another folder, Outlook should erase the old selection rect and draw a new one on the new folder. But it sometimes doesn't do that - it leaves the old selection rect, and draws a new one. So it looks like you've multi-selected folders (which you can't do). Sometimes you can get all of the folders to draw selected, sometimes it will clear the rect on a folder. It will draw correctly if you resize the Folder pane.

Has anyone seen either of these before?
Posted 12 Nov, 2008 11:52:54 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Chris,

1. I suspect that a non-released COM object can be the cause of this behavior. For instance, in my Outlook 2003 I had an add-in that didn't release a COM object. Now I have it turned off and this problem occurs when I close Outlook in the middle of sending/receiving.

Recently I published a post on our blog. Please see http://www.add-in-express.com/creating-addins-blog/2008/10/30/releasing-office-objects-net/.

2. We've fixed this bug. Please install 2008.4.4. It is available here - http://www.add-in-express.com/downloads/adxnet.php


Andrei Smolin
Add-in Express Team Leader
Posted 12 Nov, 2008 14:30:06 Top
Chris Losinger




Posts: 4
Joined: 2008-11-12
thanks for the info.

1. read the article... have a question...

we have code like this everywhere in our addin:

Outlook.Selection selection = OutlookApp.ActiveExplorer().Selection;


and

object olitem = OutlookApp.ActiveInspector().CurrentItem;


and

object olitem = OutlookApp.Application.GetNamespace("MAPI").GetItemFromID(sEntryID, System.Type.Missing);


do all those chained references need to broken down so that we can do ReleaseComObject calls on each sub-part ?

and, what's the best way to know which parts of a chain like that need to be Released, and which don't ?
Posted 12 Nov, 2008 16:53:45 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Chris,

do all those chained references need to broken down so that we can do ReleaseComObject calls on each sub-part ?


Yes.

what's the best way to know which parts of a chain like that need to be Released, and which don't ?


In the same article, see the following chapter:
How to determine if this or that property or method returns a COM object?


Andrei Smolin
Add-in Express Team Leader
Posted 13 Nov, 2008 12:19:00 Top