Friday, July 16, 2010

Sending tasks using Microsoft Outlook 11.0

This is the simplest way for creating and sending a task

First add Reference to Microsoft 11.0 object library from Add Reference and click on COM tab.

code :
using Outlook = Microsoft.Office.Interop.Outlook;

'Create objects of ApplicationClass and TaskItem as follows :
Outlook.ApplicationClass app = new Outlook.ApplicationClass();
Outlook.TaskItem task = (Outlook.TaskItem)
app.CreateItem(Outlook.OlItemType.olTaskItem);

'Set task property :
task.StartDate = DateTime.Now;
task.DueDate = DateTime.Now;
task.Subject = "Test";
task.Body = "Testing";
task.Recipients.Add(xyz@xyz.com);
task.Assign();
task.Send();

1 comment: