Stop or Resume an Assignment
Contents
[
Hide
Show
]Stop or Resume an Assignment
The ResourceAssignment class exposes properties for reading and writing an assignment’s stop and resume date:
- Stop reads or writes an assignment’s stop date (Date).
- Resume reads or writes an assignment’s resume date (Date).
To see an assignment’s stop and resume dates in Microsoft Project:
- On the Task Usage screen, select Insert and then Column.
- Add the desired columns.
Assignment stop and resume dates in Microsoft Project
Getting an Assignment’s Stop and Resume Dates using Aspose.Tasks
If an assignment hasn’t been stopped, the stop and resume dates have the value NA. In the evaluation version of Aspose.Tasks, values equal to NA gets the value “1/1/2000”. In the licensed version, NA values equal DateTime.MinValue.
In the following example, an assignment’s stop and resume dates are displayed in a console window after the code’s traversed the assignments in the project.
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(StopResumeAssignment.class);
4
5Project prj = new Project(dataDir + "project5.mpp");
6
7for (ResourceAssignment ra : prj.getResourceAssignments()) {
8 if (ra.get(Asn.STOP).toString() == "1/1/2000")
9 System.out.println("NA");
10 else
11 System.out.println(ra.get(Asn.STOP).toString());
12 if (ra.get(Asn.RESUME).toString() == "1/1/2000")
13 System.out.println("NA");
14 else
15 System.out.println(ra.get(Asn.RESUME).toString());
16}