Click here to Skip to main content
11,496,146 members (476 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: C# Outlook Interop
Dear All,
I am developing a windows application which has this feature:
When some button is pressed, it will create a outlook task.
This my code in C#:
using Microsoft.Office.Core;
using Microsoft.Office.Interop.Outlook;
private void button1_Click(object sender, EventArgs e)
    TaskItem OutlookTask = new TaskItem();
    OutlookTask.Subject = "Testing The Tasks from my application";
    OutlookTask.Body = "Body: Testing The Tasks from my application";
    OutlookTask.DueDate = DateTime.Today;
    OutlookTask.ReminderTime = OutlookTask.DueDate;
This is the error I get:
Retrieving the COM class factory for component with CLSID {00061032-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Note: I added the reference to use Outlook which is: Microsoft Outlook 14.0 Object Library. I am using VS 2010, and Outlook 2010

Does anybody have an idea what can cause this?

Thanks in advance!
Posted 4-Jan-11 5:25am
Edited 4-Jan-11 5:33am
Manfred R. Bihy at 4-Jan-11 10:34am
Edit: Grammar and spelling, added Outlook and Interop tags, code tags and indentation.
Is MS Office Outlook installed on the machine running the application?
You could also have an issue of 32bit MS Office vs a 64bit machine.

One reason is already suggested to you by Manfred, other could be if Microsoft Outlook is not properly installed and configured on the system. Basically you should be able to run Outlook outside of your application too.

Support links: Link 1[^]
Link 2[^]
Good morning,
Outlook is installed on the running machine.
My machine is 64bit.
I've changed the CPU into X86 in VS 2010, but the problem still appear.
The error is fired exactly in the following line:

TaskItem OutlookTask = new TaskItem();

and thank you for your replies.

Mark Nischalke at 5-Jan-11 8:59am
Don't add an answer. You should modify your original question to provide additional information
You can't create a Task using new

TaskItem OutlookTask = (TaskItem)Application.CreateItem(OlItemType.olTaskItem);


TaskItem OutlookTask = tasks.Items.add(OlItemType.olTaskItem);
Mark Nischalke at 5-Jan-11 8:58am
You need to do some work on your own. The code was an example and MUST be configured appropriately for YOUR application.

If you want code written for you then contact me to discuss rates.
obarahmeh at 5-Jan-11 8:40am
There is an error for your sentences:
TaskItem OutlookTask = (TaskItem)Application.CreateItem(OlItemType.olTaskItem);
Application is an ambiguous between Outlook.Application and Window.forms.Application .

and the second sentence:
TaskItem OutlookTask = tasks.Items.add(OlItemType.olTaskItem);
shows an error in tasks which does not exist in this context

Is there any missing, any references??

I've referenced the following:
using Microsoft.Office.Core;
using Microsoft.Office.Interop.Outlook;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 5 Jan 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100