Guest
Guest
|
Hi,
I would like to add an option to the New Mail window so that, when I press a button, I collect information about the e-mail being written by the user and do something with this info, eventually programmatically modifying it.
For example, I press "My Send Fax" button and I want to read the addreses from To, CC, BCC, Subject and Body textboxes, find the fax number for each contact and finally send the fax with an external app.
Is it possible to modify the To, CC and BCC addreses in GUI before sending the mail or fax?
Can this be achieved with Add-In Express?
Thank you,
Robert |
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Robert,
All the fields you mention can be accessed via Outlook Object Model and can be changed programmatically. So, the answer to all your questions is "yes". I should warn you that some of the properties are protected with Outlook Security Guard, so accessing them can invoke a security warning.
|
|
Guest
Guest
|
Hi Dmitry,
I've tried the following code with Add-In Express demo from Torry:
procedure TAddInModule.MyInspBarControls0Click(Sender: TObject);
var
IMail : MailItem;
begin
if assigned(OutlookApp.ActiveInspector.CurrentItem) then
OutlookApp.ActiveInspector.CurrentItem.QueryInterface(IID__MailItem, IMail);
if assigned(IMail) then
try
if IMail.EntryID = '' then
begin
ShowMessage(IMail.To_);
ShowMessage(IMail.CC);
IMail.CC := IMail.CC + ';robert.mircea@xyz.net';
IMail.Subject := 'My Subject 1';
IMail.Body := 'My very own body'#13#10'Second line';
end
finally
IMail := nil;
end;
end;
Setting fields does not seem to be a problem, but reading always gets empty strings no matter what I filled manually in the New Mail window.
More, how do I access the FROM field which specifies message sender or more information about sender?
Is there an event in OOM which intercepts Outlook's OnSend just before triggering?
Regards,
Robert |
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Robert,
You can try to save the mail item after changing. Or try to change email recipients via the Recipients collection of the _MailItem interface.
More, how do I access the FROM field which specifies message sender or more information about sender?
The SenderName, SenderEmailType and SenderEmailAddress properties appeared only in the Object Model of Outlook 2003. In earlier versions of Outlook you can get these properties via Extended MAPI or CDO.
Is there an event in OOM which intercepts Outlook's OnSend just before triggering?
See the Cancel parameter of the OutlookApp.OnItemSend event.
|
|