Martin Bayly
Posts: 41
Joined: 2007-10-05
|
OL2007
ADX 3.8 1886.2005
This is probably an Outlook issue rather than an ADX issue but wondered if someone here could help?
We're using ADXOutlookAppEvents to handle ItemSend and InspectorClose events.
InspectorClose seems to get called:
1. If you just close an open inspector by closing the Inspector window
2. If you send the message in the open inspector. In this case ItemSend is called followed by InspectorClose.
We have code in InspectorClose that interrogates properties of the inspector's current item.
_Inspector olInsp = inspector as _Inspector;
MailItem mi = olInsp.CurrentItem as MailItem;
if (mi != null)
{
string subject = mi.Subject; // throws exception after Send
}
In the scenario where the inspector has just been closed this code works fine. However, when it's called after an ItemSend, it seems like any attempt to access properties of the CurrentItem results in a
System.Runtime.InteropServices.COMException (0x8004010A): The item has been moved or deleted.
Of course we can just catch and ignore the exception. Or possibly we could store something in our ItemSend handler so that we could skip this code after a send (assuming events are sent in order which I don't want to rely on).
Anyone know of a way to test if the item is valid without throwing exceptions?
Thanks
Martin |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Martin.
I would advise you to use ADXOutlookItemEvents class to make the changes in the inspector item. Please see the OutlookItemEvents example from the Add-in Express installation package. |
|