Carlos Jimenez
Guest
|
Hi!
I need to handle Tasks when I send them from Outlook, but I dont now how.
I already handle Mails. Here the CODE to do that.
Can I manage the Tasks in the same procedure "Enviar"?
Thanks in advance for the help!
-- Carlos
cjimenez@intelisis.com.mx
*** CODE ***
type
TPrueba_Outlook = class(TadxAddin, IPrueba_Outlook)
end;
TAddInModule = class(TadxCOMAddInModule)
procedure adxCOMAddInModuleAddInInitialize(Sender: TObject);
procedure adxCOMAddInModuleAddInFinalize(Sender: TObject);
procedure ExplorerCommandbarControls0Click(Sender: TObject);
private
procedure ProcesarElemento(Tipo: String; const Item: IDispatch);
procedure Enviar(ASender: TObject; const Item: IDispatch; var Cancel: WordBool);
procedure Recibir(Sender: TObject);
procedure Iniciar(Sender: TObject);
public
Recibido: Boolean;
end;
...
procedure TAddInModule.adxCOMAddInModuleAddInInitialize(Sender: TObject);
begin
(* Application handle *)
Application.Handle:=GetActiveWindow;
(* Outlook events *)
OutlookApp.OnItemSend:=Enviar;
OutlookApp.OnNewMail:=Recibir;
OutlookApp.OnStartup:=Iniciar;
end;
...
procedure TAddInModule.Enviar(ASender: TObject; const Item: IDispatch; var Cancel: WordBool);
var
Mail: MailItem;
begin
if Assigned(Item) then begin
Item.QueryInterface(IID__MailItem, Mail);
ProcesarElemento('Correo', Item);
end;
end;
...
procedure TAddInModule.adxCOMAddInModuleAddInFinalize(Sender: TObject);
begin
OutlookApp.OnItemSend:=Nil;
OutlookApp.OnNewMail:=Nil;
OutlookApp.OnStartup:=Nil;
end;
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Carlos,
Yes, you can handle the Outlook task item in the same procedure. See the code below:
procedure TAddInModule.Enviar(ASender: TObject; const Item: IDispatch; var Cancel: WordBool);
var
Task: TaskRequestItem;
begin
if Assigned(Item) then begin
Item.QueryInterface(IID__TaskRequestItem, Task);
if Assigned(Task) then
try
ProcesarElemento('Correo', Task);
finally
Task := nil;
end;
end;
end;
|
|