Organize MS Outlook Tasks into calendar and task-hierarchy
- I want to organize my task list using MS 2007 but I found it lacking the following features that I need:
- display tasks in the calendar
- allow tasks to have sub-tasks (much like a task-hierarchy)
(Btw, which is better to use for these requirements, VS or VBA?)
Is there any similar existing add-in or project that has already been developed
by the community that I can start on?
a filipino newbie
Answers
Hello,
Originally, the tasks are stored in task folder. If want to display in the calendar folder, we could use ItemAdd event of task folder, and then move this task item to calendar folder. Code like this,
Outlook.Items items;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
//Outlook.TaskItem ti = this.Application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olTaskItem) as Outlook.TaskItem;
//ti.Subject = "Test11";
//ti.Save();
Outlook.Folder folderTask = this.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks) as Outlook.Folder;
items = folderTask.Items;
items.ItemAdd += new Microsoft.Office.Interop.Outlook.ItemsEvents_ItemAddEventHandler(items_ItemAdd);
}void items_ItemAdd(object Item)
{
Outlook.TaskItem ti = Item as Outlook.TaskItem;
Outlook.MAPIFolder folder=Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.MAPIFolder;
ti.Move(folder);
}
Now, when a task item is created and saved, it will be stored in task folder, and trigger ItemAdd event. Finally in this event handler, it will be moved to calendar folder.
For VBA or VSTO, I think it is also can be achieved by using VBA. From this blog article, here I quote a statement, VBA is a scripting language supported in several Office applications, and VSTO is a Visual Studio enhancement to support .NET managed code development for Word and Excel documents and Outlook add-ins. Also you could refer to this article to get more insight about VBA. About VSTO, you could refer to this forum's PLEASE READ FIRST.
Unfortunately, task hierarchy does not support by Outlook object model. For this, please refer to this blog, especially the comments, and this link.
Best regards,
Bessie
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer bysuperkuton Sunday, November 15, 2009 12:14 PM
All Replies
Hello,
Originally, the tasks are stored in task folder. If want to display in the calendar folder, we could use ItemAdd event of task folder, and then move this task item to calendar folder. Code like this,
Outlook.Items items;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
//Outlook.TaskItem ti = this.Application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olTaskItem) as Outlook.TaskItem;
//ti.Subject = "Test11";
//ti.Save();
Outlook.Folder folderTask = this.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks) as Outlook.Folder;
items = folderTask.Items;
items.ItemAdd += new Microsoft.Office.Interop.Outlook.ItemsEvents_ItemAddEventHandler(items_ItemAdd);
}void items_ItemAdd(object Item)
{
Outlook.TaskItem ti = Item as Outlook.TaskItem;
Outlook.MAPIFolder folder=Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.MAPIFolder;
ti.Move(folder);
}
Now, when a task item is created and saved, it will be stored in task folder, and trigger ItemAdd event. Finally in this event handler, it will be moved to calendar folder.
For VBA or VSTO, I think it is also can be achieved by using VBA. From this blog article, here I quote a statement, VBA is a scripting language supported in several Office applications, and VSTO is a Visual Studio enhancement to support .NET managed code development for Word and Excel documents and Outlook add-ins. Also you could refer to this article to get more insight about VBA. About VSTO, you could refer to this forum's PLEASE READ FIRST.
Unfortunately, task hierarchy does not support by Outlook object model. For this, please refer to this blog, especially the comments, and this link.
Best regards,
Bessie
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer bysuperkuton Sunday, November 15, 2009 12:14 PM


