Solved

Hooking into MS-OFFICE / OUTLOOK 2000 from Delphi 5

Posted on 2000-05-15
2
348 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
proper way to parse text with delphi 7 137
Delphi cmd execution 6 66
Mobile Keyboard covers the display of the TMemo 3 95
Press three keys together and trigger a function 3 60
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…

789 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