/// <summary>
 /// Allows to delete the selected task
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="e">EventArgs</param>
 private void mnuItemDeleteTask_Click(object sender, EventArgs e)
 {
     if (this.lstTasks.SelectedIndices.Count != 0)
     {
         OLTaskItem task = this.lstTasks.SelectedItems[0].Tag as OLTaskItem;
         if (task != null)
         {
             if (MessageBox.Show("Are you sure you want to delete this task?", "Delete task", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 if (task.OriginalItem is Outlook.MailItem)
                 {
                     Outlook.MailItem mail = task.OriginalItem as Outlook.MailItem;
                     mail.Delete();
                 }
                 else if (task.OriginalItem is Outlook.ContactItem)
                 {
                     Outlook.ContactItem contact = task.OriginalItem as Outlook.ContactItem;
                     contact.Delete();
                 }
                 else if (task.OriginalItem is Outlook.TaskItem)
                 {
                     Outlook.TaskItem t = task.OriginalItem as Outlook.TaskItem;
                     t.Delete();
                 }
                 else
                 {
                     // Do nothing
                 }
             }
             // At the end, synchronously "refresh" tasks in case they have changed
             this.RetrieveTasks();
         }
     }
 }
        public void DeleteTask(OutlookTask task)
        {
            OutlookTask outlookTask = task as OutlookTask;

            Outlook.TaskItem taskitem = outlookApp.Session.GetItemFromID(outlookTask.EntryId) as Outlook.TaskItem;
            taskitem.Delete();
        }