Solved

Add Outlook task item

Posted on 2006-07-15
6
670 Views
Last Modified: 2010-04-05
I am using ms outlook 2003. I want my application to create outlook tasks automatically, based on the dates in my database and assign tasks to contact in my contacts folder. How can I achieve this?

Thanks
0
Comment
Question by:drnadeem
  • 3
  • 2
6 Comments
 
LVL 1

Author Comment

by:drnadeem
ID: 17119871
POints are going up
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 17119957
http://www.add-in-express.com/

There you can purchase a component set that should help you to include task items into Outlook. They also offer you a solution to bypass the Outlook security, which you will need when using Outlook 2003.
0
 
LVL 1

Author Comment

by:drnadeem
ID: 17120431
I am not trying to develop an add in, but rather automate outlook to add a new task via my program.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 26

Accepted Solution

by:
Russell Libby earned 500 total points
ID: 17154677

Adding the task request is a pretty simple deal, eg (include ComObj, ActiveX in uses):

var  ovOutlook:     OleVariant;
     ovItem:        OleVariant;
begin

  ovOutlook:=CreateOleObject('Outlook.Application');
  try
     ovItem:=ovOutlook.CreateItem(3);
     try
        ovItem.Recipients.Add('foo@bar.net');
        ovItem.Subject:='Prepare Agenda For Meeting';
        ovItem.DueDate:='7/22/2006';
        ovItem.Assign;
        ovItem.Send;
     finally
        ovItem:=Unassigned;
     end;
  finally
     ovOutlook.Quit;
     ovOutlook:=Unassigned;
  end;

end;

The problem comes from Outlooks security model kicking in. As soon as you set do anything related to emailing (and no UI is being displayed), then Outlook kicks up dialogs to the user indicating that a script is trying to automate such and such. If your ok with that, then the task should be straightforward.

If this isn't ok, I can tell you what needs to be done, but without all the tools (difficult to come by) it will be a headache.

- If an application has been digitally signed (even self signed), then Outlook can import the certificate, allowing the application to automate Outlook without the security warnings. In the "C:\Program Files\Microsoft Office\OFFICE11" folder a program called selfcert.exe can be found, which will allow you to create a self signed cert. I know on my old Delphi 3 Ent, I had the signcode.exe program that you will need to get hold of in order to digitially "sign" your exe application. For VB, the task seems much easier as they the tools readily available.

http://www.microsoft.com/technet/prodtechnol/office/office2000/maintain/security/vbamacro.mspx

Anyways, once signed, the private cert can be imported into Outlook, which will then let your program run unhindered.

Regards,
Russell







0
 
LVL 1

Author Comment

by:drnadeem
ID: 17162915
Russel,
Your example works fine. One little thing though:

When I use

ovItem.Reminderdate := '7/23/2006'

I get error message Method 'ReminderDate' not allowed?
Any way I can add a reminder date to the task?
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 17167952

There seems to be a little confusion...
First, the ReminderTime (eg '7/28/2006 08:00AM') is the property that needs to be set, along with ReminderSet:=True. But this is only supported if you are creating a task for yourself. (eg, no recipients / no Assign). Its an either / or situation. If you wish to visually see the logic, go into Outlook and create a new task. You will notice that you can set the reminder date/time, but notice what happens when you click the assign button.

Regards,
Russell
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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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