Properties of Tasks and Appointments of Outlook

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

Properties of Tasks and Appointments of Outlook
Can't find some properties of Tasks and Appointments of Outlook 
Carlos Jimenez


Guest



Hi There!

When Outlook generates a new element, that element can be a mail, a task, an appointment, etc.


I can identify, in the OutlookApp.OnItemSend event, if that element is a mail, a task or an appointment (mail, task and appointment are the elements that interest to me to control).

If the element is a mail, I can easily find its properties, like:

procedure TAddInModule.ProcesarElemento(Tipo: String; const Item: IDispatch);
var
Mail: MailItem;
begin
if Assigned(Item) then begin
Item.QueryInterface(IID__MailItem, Mail);
if Assigned(Mail) then begin
try
...
Mail.SenderName
Mail.Subject
Mail.EntryID
Mail.Attachments.Count
Mail.Attachments.Item(i).DisplayName
Mail.HTMLBody
Mail.Body
Mail.Importance
Mail.Recipients.Count
Mail.Recipients.Item(i).Address
...
finally
Mail:=Nil;
end;
end;
end;
end;


But if the element is a task, I cannot find all the properties that I need:

procedure TAddInModule.ProcesarElemento(Tipo: String; const Item: IDispatch);
var
Task: TaskRequestItem;
begin
if Assigned(Item) then begin
Item.QueryInterface(IID__TaskRequestItem, Task);
if Assigned(Task) then begin
try
...
Task.ConversationTopic Yes
Task.Attachments.Count Yes
Task.Attachments.Item(i).DisplayName Yes
Task.Importance Yes
Task.Body Yes
...
Task.To_ No
Task.Status No
Task.Delegator No
Task.StartDate No
Task.DateCompleted No
Task.DueDate No
Task.PercentComplete No
...
finally
Task:=Nil;
end;
end;
end;
end;


And if the element is an appointment, not even I can assign the element correctly, since I always obtain the message 'Appointment not assigned'.

procedure TAddInModule.Enviar(ASender: TObject; const Item: IDispatch; var Cancel: WordBool);
var
Mail: MailItem;
Task: TaskRequestItem;
Appointment: AppointmentItem;
begin
if Assigned(Item) then begin
Item.QueryInterface(IID__TaskRequestItem, Task);
if Assigned(Task) then begin
try
ProcesarElemento('Tarea', Item);
finally
Task:=Nil;
end;
end else begin
Item.QueryInterface(IID__MailItem, Mail);
if Assigned(Mail) then begin
try
ProcesarElemento('Correo', Item);
finally
Mail:=Nil;
end;
end else begin
Item.QueryInterface(IID__AppointmentItem, Appointment);
if Assigned(Appointment) then begin
try
ProcesarElemento('Cita', Item);
finally
Appointment:=Nil;
end;
end else begin
ShowMessage('Appointment not assigned');
end;
end;
end;
end else
ShowMessage('Item not assigned');
end;


What am I doing wrong?


I already download the examples from http://www.add-in-express.com/downloads/free-addins.php
(adxtoys2ol.exe, adxtoys2olem.exe) and from
http://www.add-in-express.com/support/addin-delphi.php
(all the relative to Outlook) and I can't find nothing about Task or Appoinments.

If somebody had code that handles these elements and this properties of the elements, it would be much more easy to understand how they work.

Any help or idea is welcome.


Thanks in advance.


Carlos Jimenez
cjimenez@intelisis.com.mx
Posted 22 Apr, 2005 12:50:43 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Carlos,

But if the element is a task, I cannot find all the properties that I need:

As you can see this is not task item, this is TaskRequestItem interface. Try to use the GetAssociatedTask method to get the TaskItem object and then get the necessary properties from it.

And if the element is an appointment, not even I can assign the element correctly, since I always obtain the message 'Appointment not assigned'.

The Appointment item can't be sent. Try to get the MeetingItem interface there. See also GetAssociatedAppointment method of the MeetingItem interface.

Posted 23 Apr, 2005 13:40:29 Top
Carlos Jimenez


Guest


Hi Dmitry!

I am very grateful for your help

I've had never handled Outlook elements previously and I must figure it all out for my job.

Following your instructions I could finally see the tasks and the appointments properties.

I only need to detect any time a task is modified o deleted, that is, either if the % completed is altered or if the task is finished or if the task is erased.

In which event I can identify this? And is it the same event for the appointment?

I hope this is my last request. I don't want you to do my job, I just need a little guidance.

I promise not to bother (so much).

Thank you very much.


Carlos Jimenez
cjimenez@intelisis.com.mx
Posted 28 Apr, 2005 13:49:02 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Carlos,

Almost every Outlook item has events like Open, Close, Read, Write, etc. Outlook XP and higher also has the BeforeDelete event. I think these events will help you to do what you need.

Posted 29 Apr, 2005 07:59:44 Top