Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Add Outlook task item

Posted on 2006-07-15
6
Medium Priority
?
775 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 26

Accepted Solution

by:
Russell Libby earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview

876 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