Solved

Hooking into MS-OFFICE / OUTLOOK 2000 from Delphi 5

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Working this component WebCopy with proxy, help 3 84
LAN or WAN ? 11 90
Dynamically Created Query 3 55
Firemonkey android show image from resource ? 1 42
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…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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