Edit Outlook message?

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

Edit Outlook message?
 
Asaf G




Posts: 8
Joined: 2004-10-07
Is there a way to edit an Outlook email message using Add-In V2.2

Thanks in advanced,
Asaf
Posted 18 Oct, 2004 16:35:18 Top
Dmitry Kostochko


Add-in Express team


Posts: 2740
Joined: 2004-04-05
Hello Asaf,

The Add-in Express has the OutlookApp: TOutlookApplication property. It is a kind of starting point that enables a developer to access Outlook Object Model (OOM). Using OOM you can edit a message, create a new one, delete, etc.

Sincerely,
ADX Support Team
Posted 19 Oct, 2004 05:47:43 Top
Guest


Guest


Hi Dmitry,

A simple example will be much appreciated.

Regards,
Asaf
Posted 19 Oct, 2004 06:07:55 Top
Dmitry Kostochko


Add-in Express team


Posts: 2740
Joined: 2004-04-05
Ok, see the code below:

procedure TAddInModule.adxCommandBar1Controls0Click(Sender: TObject);
var
  IDsp: IDispatch;
  IMail: MailItem;
begin
  if OutlookApp.ActiveExplorer.Selection.Count
>
0 then begin
    IDsp := OutlookApp.ActiveExplorer.Selection.Item(1);
    if Assigned(IDsp) then
      try
        IDsp.QueryInterface(IID__MailItem, IMail);
        if Assigned(IMail) then
          try
            IMail.Subject := 'New Subject';
            IMail.Save;
          finally
            IMail := nil;
          end;
      finally
        IDsp := nil;
      end;
  end;
end;


Sincerely,
ADX Support Team
Posted 19 Oct, 2004 06:48:50 Top
Guest


Guest


Thanks for your help Dmitry.

Regards,
Asaf
Posted 19 Oct, 2004 07:02:20 Top