Working with Tasks

Get Outlook Task Details from a OneNote Document

The NoteTask class provides all the properties related to a Microsoft OneNote document’s Outlook tasks. All the file’s Outlook tasks are contained by RichText nodes in the Document object. The code example given below demonstrates how to get details about each Outlook task from a OneNote document.

 1// The path to the documents directory.
 2string dataDir = RunExamples.GetDataDir_Tasks();
 3
 4// Load the document into Aspose.Note.
 5Document oneFile = new Document(dataDir + "Aspose.one");
 6
 7// Get all RichText nodes
 8IList<RichText> nodes = oneFile.GetChildNodes<RichText>();
 9
10// Iterate through each node
11foreach (RichText richText in nodes)
12{
13    foreach (var tag in richText.Tags)
14    {
15        if (tag is NoteTask)
16        {
17            NoteTask noteTask = (NoteTask)tag;
18            // Retrieve properties
19            Console.WriteLine("Completed Time: " + noteTask.CompletedTime);
20            Console.WriteLine("Create Time: " + noteTask.CreationTime);
21            Console.WriteLine("Due Date: " + noteTask.DueDate);
22            Console.WriteLine("Status: " + noteTask.Status);
23            Console.WriteLine("Task Type: " + noteTask.TaskType);
24            Console.WriteLine("Icon: " + noteTask.Icon);
25        }
26    }
27}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.