Solved

Hooking into MS-OFFICE / OUTLOOK 2000 from Delphi 5

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

15 Experts available now in Live!

Get 1:1 Help Now