Mike M.
Posts: 31
Joined: 2006-11-13
|
I am using an Adx Outlook Events object in my Outlook add-in and is handling the ExplorerSelectionChange event.
Sometimes I get a COM exception when I try to access the explorer objects passed to this event handler:
private void HandleExplorerSelectionChangeAdxOutlookEvent(object sender, object explorerObject)
{
Explorer explorer = (Explorer) explorerObject;
Selection selection = null;
try
{
selection = explorer.Selection; <------- HERE a COM exception is thrown with this message:
"The Explorer has been closed and cannot be used for further operations. Review your code and restart Outlook."
This happens when I in Outlook tries access a folder having a homepage specified that does not exist:
1) I have a mail folder in my personal folders, which has a non existing homepage file specified (Outlook displays a blank explorer saying "Unable to display the folder when I click this folder.").
2) When I click the folder with the non existing homepage, the selection changed event is fired, and when my handler tries to access the explorer object passed to the handler, the above COM exception is thrown.
QUESTION 1:
Is this an error in the ADX Outlook event object?
QUESTION 2:
IS there a workaround? Is there any way I can test the "closed state" of an explorer object before acessing it?
best regards Mike |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Mike.
1. No, this is an Outlook feature.
2. Please use try ... catch operators to prevent this issue.
try
{
selection = explorer.Selection
}
catch
{
} |
|