Outlook 2007 Addin: View and Edit Email Before Sending




I am trying to capture emails before they are sent and view/edit the To,
CC, and BCC fields. I would also like to append a message to the bottom of
the message body.

I am trying to capture the 'Item' within the sub
'Application_ItemSend(ByVal Item As Object, ByRef Cancel As Boolean)' and
convert the Item to a 'Outlook.MailItem'. That way, I believe that I can
view and edit these items.

How do I convert the 'Item' object into a 'MailItem' object? Here is my
code in VB:

Private Sub Application_ItemSend(ByVal Item As Object, ByRef Cancel As
Boolean) Handles Application.ItemSend
Dim mess As Outlook.MailItem
mess = Convert.ChangeType(Item, "Outlook.MailItem")
End Sub

Any help in VB or C# would be appreciated!!

Ken Slovak - [MVP - Outlook]


Outlook.MailItem mess = (Outlook.MailItem)Item;


Dim mess As Outlook.MailItem = CType(Item, Outlook.MailItem)

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question