Custom functionality upon Send New mail button click.

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

Custom functionality upon Send New mail button click.
 
Oliver Degnan




Posts: 54
Joined: 2005-02-03
I added a new Button onto a CommandInspectorBar in the Mail window (New E-mail Window). When I click this button, I want to validate and save all the fields such as FROM, TO, SUBJECT, BODY, ATTACHMENT into a database.

How can I accomplish this?
How do I get all those items from those fields from that form?

Thank you so much for your help.
I love your product. :)

Oliver
Posted 15 Feb, 2005 14:45:00 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Oliver, just add the code below to the button event handler of inspector command bar.
private void adxCommandBarButton1_Click(object sender)
{
Outlook._MailItem mailObj;
Outlook._Inspector inspector = OutlookHost().ActiveInspector();
if (inspector == null) return;
object item = inspector.CurrentItem;
if (item is Outlook._MailItem)
{
mailObj = item as Outlook._MailItem;
string to = mailObj.To;
string subject = mailObj.Subject;
string body = mailObj.Body;
string from = mailObj.SenderName;
// do something
Marshal.ReleaseComObject(item);
}
Marshal.ReleaseComObject(inspector);
}
Posted 16 Feb, 2005 06:21:13 Top
Oliver Degnan




Posts: 54
Joined: 2005-02-03
Thank you so much! You guys rock!!

Oliver
Posted 16 Feb, 2005 09:11:22 Top