Solved

Add Outlook task item

Posted on 2006-07-15
6
655 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
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.

 
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 258
Delphi selector screen 2 78
Working with hours 3 54
tidtcpserver connection lost handle 2 83
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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
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…

816 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

10 Experts available now in Live!

Get 1:1 Help Now