Solved

Hooking into MS-OFFICE / OUTLOOK 2000 from Delphi 5

Posted on 2000-05-15
2
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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
Help on project with Soap 10 63
Print Graphic and Text to Epson TM-T88v 12 466
Firemonkey webbrowser scrollbars ? 1 57
How to save the image in the .cds File ClientDataSet? 1 30
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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