Independentsoft
Professional software libraries for developers
Home
Purchase
Support
Company
Contact
JPST
>
Tutorial
> Get tasks
The following example shows you how to get tasks from the Tasks folder.
import java.io.IOException; import java.util.List; import com.independentsoft.pst.Folder; import com.independentsoft.pst.Item; import com.independentsoft.pst.PstFile; import com.independentsoft.pst.Task; public class Example { public static void main(String[] args) { try { PstFile file = new PstFile("c:\\testfolder\\Outlook.pst"); try { Folder startFolder = file.getMailboxRoot(); Folder tasksFolder = startFolder.getFolder("Tasks"); if (tasksFolder != null) { List
items = tasksFolder.getItems(); for (int m = 0; m < items.size(); m++) { if (items.get(m) instanceof Task) { Task task = (Task) items.get(m); System.out.println("Id: " + task.getId()); System.out.println("Subject: " + task.getSubject()); System.out.println("StartDate: " + task.getStartDate()); System.out.println("DueDate: " + task.getDueDate()); System.out.println("Owner: " + task.getOwner()); System.out.println("Body: " + task.getBody()); System.out.println("----------------------------------------------------------------"); } } } } finally { if (file != null) { file.close(); } } } catch (IOException e) { e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*