Solved

Hooking into MS-OFFICE / OUTLOOK 2000 from Delphi 5

Posted on 2000-05-15
2
344 Views
Last Modified: 2010-04-04
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;
begin

  OutlookApp := initOutlook;
  if NOT varIsEmpty(OutlookApp) then
  begin
    NewTaskItem := OutlookApp.CreateItem(3);
    NewTaskItem.DueDate := Date;
    NewTaskItem.Subject := 'Test task insert from Delphi';
    NewTaskItem.Save;
  end;
end;

function TfmLinktoRequestDocumentFrame.initOutlook : OLEvariant;
begin
      try
    try
      Result := GetActiveOLEObject('Outlook.Application');
    except
      Result := CreateOLEObject('Outlook.Application');
    end;
  except on EOleSysError  do
    Result := Unassigned
  end;
end;
0
Comment
Question by:Vexayshin
2 Comments
 

Accepted Solution

by:
voodoobunny earned 200 total points
ID: 2810307
Hi Vexayshin,

Couple of things:

First, the property is ReminderSet which is wny you can't find it :).  There is also a property ReminderTime which is the date and time at which the reminder should occur.  This I assume will also set the ReminderSet property.

I think the way COM works is that you create an instance of a top-level object (in this case Outlook.Application) and then you ask it to give you a sub-object (eg the Task which you created).  In this example the usage is similar to the way you would use a static object (eg a TMemo top-level which has a TStrings sub-object;  you create the TMemo and then ask it for a TStrings which it gives you).

Sincerely,
voodoobunny
0
 
LVL 17

Expert Comment

by:inthe
ID: 2810336
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now