Retrieve values for sent emails.

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

Retrieve values for sent emails.
AddinExpress opens an Outlook new email form and wants the values used passed back. 
Russell Weetch




Posts: 9
Joined: 2009-02-05
I have an app which calls an Outlook AddInExpress plugin to create an email. The user can then edit the email and when it is sent I want the actual values used passed back to the calling application. The current function doesn't quite work. Any ideas of the best way to do this? I'd also like to return whether the email was sent, saved or cancelled as the return result.

This is the current function:

function TCoSmPlugin.SendMail(var To_, CC, BCC, Subject, Body: OleVariant): SYSINT;
var
Mail : MailItem;
Modal : OleVariant;
begin

Mail := GlobalOutlookInstance.CreateItem(olMailItem) as MailItem;
Mail.To_ := To_;
Mail.CC := CC;
Mail.BCC := BCC;
Mail.Subject := Subject;
Mail.Body := Body;

Modal := true;
Mail.Display(Modal);

//works to here

To_ := Mail.To_;
CC := Mail.CC;
BCC := Mail.BCC;
Subject := Mail.Subject;
Body := Mail.Body;

end;

Any help gratefully received
Posted 15 Sep, 2010 12:56:05 Top
Russell Weetch




Posts: 9
Joined: 2009-02-05
Just some clarification. It does complete the procedure but the values it sets to the vars are the same as those passed into the procedure, not the ones in the email actually sent. Also after Mail.Display(Modal) I need to test to see if the email was sent, cancelled or saved.
Posted 16 Sep, 2010 04:28:18 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Russell,

Russell Weetch wrote:
...but the values it sets to the vars are the same as those passed into the procedure


Try saving the item before retrieving the values.

Russell Weetch wrote:
Also after Mail.Display(Modal) I need to test to see if the email was sent, cancelled or saved.


The only way I see is intercept corresponding events or built-in controls that the user clicks to send, cancel or save item. If those events occur before the form is closed, you can use some flags to find the user's choice.


Andrei Smolin
Add-in Express Team Leader
Posted 20 Sep, 2010 08:24:14 Top