Solved

Add Outlook task item

Posted on 2006-07-15
6
639 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 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

13 Experts available now in Live!

Get 1:1 Help Now