E
Estaup
I am capturing the Application.ItemSend event without issues, the problem
comes in with what I am trying to do.
When a user clicks the Send button I do the following processing:
Lookup user to see if they have ability to send emails (this is handled with
DB table) if so cancel=false and the email is sent.
If the user does not have the ability to send emails then put the email in a
folder called "Pending" and cancel=true and do not send the email.
here is the code
myInspector = this.application.activeinspector();
Microsoft.Office.Interop.Outlook.Inspector myItem = myInspector;
mailitem = (Outlook.Mailitem)myItem.CurrentItem;
Outlook.MAPIFolder inbox =
(Outlook.MAPIFolder)this.Application.ActiveExplorer().Session.GeDefaultFolder(Outlook.OlDefaultFolders.olFolderInBox);
Outlook.MAPIFolder destFolder = inbox.Folders["Pending"];
mailitem.Move(destFolder);
cancel = true;
When this executes, the mailitem.Move(desFolder) line causes an exception
error:
Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
(This same code works just fine in Outlook 2007. The mailitem even closes.)
I have tried making a copy of the mailitem and then moving the copy to the
Pending folder. This works without issue. But the current mail item is still
displayed to the user. I can not get this to close.
Please help.
Thanks.
comes in with what I am trying to do.
When a user clicks the Send button I do the following processing:
Lookup user to see if they have ability to send emails (this is handled with
DB table) if so cancel=false and the email is sent.
If the user does not have the ability to send emails then put the email in a
folder called "Pending" and cancel=true and do not send the email.
here is the code
myInspector = this.application.activeinspector();
Microsoft.Office.Interop.Outlook.Inspector myItem = myInspector;
mailitem = (Outlook.Mailitem)myItem.CurrentItem;
Outlook.MAPIFolder inbox =
(Outlook.MAPIFolder)this.Application.ActiveExplorer().Session.GeDefaultFolder(Outlook.OlDefaultFolders.olFolderInBox);
Outlook.MAPIFolder destFolder = inbox.Folders["Pending"];
mailitem.Move(destFolder);
cancel = true;
When this executes, the mailitem.Move(desFolder) line causes an exception
error:
Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
(This same code works just fine in Outlook 2007. The mailitem even closes.)
I have tried making a copy of the mailitem and then moving the copy to the
Pending folder. This works without issue. But the current mail item is still
displayed to the user. I can not get this to close.
Please help.
Thanks.