Hooking into MS-OFFICE / OUTLOOK 2000 from Delphi 5
Posted on 2000-05-15
I am currently writing an app that requires me to create Tasks and Calendar entries in Outlook from Delphi.
I have managed this using both CreateOLEobject(Outlook.Application) and using the new Delphi 5 OutlookApplication server component.
The problem is that both of these methods seem to only expose certain selected methods of the TTaskItem object to Delphi. I can set the DueDate property for example but I can't set the SETREMINDER property which according the the VBA object inspector I should be able to.
In a nutshell, how do handle COM objects like Tasks, Contact and Calendar items properly and how does the TTaskItem server and the others actually work (I understand how the Word server and Outlook server work but how do you "connect" something that isn't an actual app, like a task)
Any reference material related to this subject or web links would be enormously appreciated.
My code at the moment looks like this :
procedure TfmLinktoRequestDocumentFrame.SpeedButton2Click(Sender: TObject);
var NewTaskItem : OLEVariant;
OutLookApp : OLEVariant;
OutlookApp := initOutlook;
if NOT varIsEmpty(OutlookApp) then
NewTaskItem := OutlookApp.CreateItem(3);
NewTaskItem.DueDate := Date;
NewTaskItem.Subject := 'Test task insert from Delphi';
function TfmLinktoRequestDocumentFrame.initOutlook : OLEvariant;
Result := GetActiveOLEObject('Outlook.Application');
Result := CreateOLEObject('Outlook.Application');
except on EOleSysError do
Result := Unassigned