Getting tasks from Access database

Getting tasks from Access database

Post by John Wrigh » Wed, 27 Jun 2007 00:23:56

I want to import a table from access into outlook's task folder. I have a
sales group of people that need to retrieve items from this database and add
it to their tasks. I would like this to be automated to kick off every two
hours. Can this be done? Does anyone have any code as an example for
this? I am an experienced VB programmer (.net and classic) but have done
very little programming in Outlook itself. The program needs to be
contained within Outlook. Any code, or examples would be great.

John Wright

Getting tasks from Access database

Post by amitbhanda » Sun, 01 Jul 2007 15:54:54

Yes, of course, you can do this rather I'll say it's a childs' play to do
all this.
However, if you say that you want to create To-do list out of that then I'll
its more trickier since the To-do list folder is virtual one and you need to
the Store to add items to To-do list folder.

See, it is independent of thing whether you want this piece of work done as
standalone application or Add-in from Outlook, if you are using OOM. I could
given you the code but that will not suffice your needs as you should write
this piece
of code according to your needs. All I can help is to provide you some
insight on
using OOM.

Before, you start, have a look at OOM structure at MSDN. Now, include the
COM library
reference in your project to Microsoft Outlook Object Library. The steps
that you need
to follow are:
1) Create an object of ApplicationClass
2) Open your access database file
3) Get a reference to the Tasks folder using MapiFolder mf = (MAPIFolder)
4) For each record in your access file, use app.CreateItem() function
5) Typecast to TaskItem object and set the appropriate properties after
reading the
columns of database
6) Call Save method
7) Viola!! you are done.

That's all with it. Now, iterate steps 4 through 6 for all the records in
your access file.

Amit Bhandari