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.

Get Outlook Task Details

A OneNote file displaying an Outlook task

todo:image_alt_text

The code below shows how to get details about each Outlook task from a OneNote document.

 1String dataDir = Utils.getSharedDataDir(GetOutlookTask.class) + "tasks/";
 2
 3// Load the document into Aspose.Note
 4Document doc = new Document(dataDir + "Sample1.one");
 5
 6// Get all RichText nodes
 7List<RichText> nodes = (List<RichText>) doc.getChildNodes(RichText.class);
 8
 9// Iterate through each node
10for (RichText richText : nodes) {
11	for (NoteTagCore tag : richText.getTags()) {
12		if (tag.getClass() == NoteTask.class) {
13			NoteTask noteTask = (NoteTask) tag;
14			// Retrieve properties
15			System.out.println("Completed Time: " + noteTask.getCompletedTime());
16			System.out.println("Create Time: " + noteTask.getCreationTime());
17			System.out.println("Due Date: " + noteTask.getDueDate());
18			System.out.println("Status: " + noteTask.getStatus());
19			System.out.println("Task Type: " + noteTask.getTaskType());
20			System.out.println("Icon: " + noteTask.getIcon());
21		}
22	}
23}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.