Stop or Resume an Assignment
translation: true type: docs template: /templates/_template-net.md linktitle: Stop or Resume an Assignment h1: Stop or Resume an Assignment title: Stop or Resume an Assignment | Aspose.Tasks Documentation weight: 80 url: /net/stop-or-resume-an-assignment/ description: Learn how to stop or resume Microsoft Project (MPP/XML) resource assignments programmatically using Aspose.Tasks for .NET. is_root: true lastmod: 2025-10-01
In Microsoft Project, resource assignments can have specific Stop and Resume dates, which define when work on an assignment is paused and when it should continue. Aspose.Tasks for .NET enables developers to programmatically read and update these properties, providing more control over scheduling and automation of project data.
Stop or Resume an Assignment
The
Asn
class provides the following properties to work with assignment scheduling:
- Stop – reads or writes an assignment’s stop date (
DateTime
). - Resume – reads or writes an assignment’s resume date (
DateTime
).
Viewing Stop and Resume Dates in Microsoft Project
To see stop and resume dates manually in Microsoft Project:
- Open the Task Usage view.
- Select Insert > Column.
- Add the Stop and Resume columns.
Reading Stop and Resume Dates using Aspose.Tasks
If an assignment has not been stopped, the Stop and Resume properties will have the value NA.
- In the evaluation version of Aspose.Tasks,
NA
values are represented as 1/1/2000. - In the licensed version,
NA
values are represented as DateTime.MinValue.
The following example demonstrates how to read stop and resume dates for resource assignments and display them in the console:
1Project project = new Project("New Project.mpp");
2
3// Print resource assignment's stop and resume dates
4foreach (ResourceAssignment ra in project.ResourceAssignments)
5{
6 if (ra.Get(Asn.Stop).ToShortDateString() == "1/1/2000")
7 Console.WriteLine("NA");
8 else
9 Console.WriteLine(ra.Get(Asn.Stop).ToShortDateString());
10
11 if (ra.Get(Asn.Resume).ToShortDateString() == "1/1/2000")
12 Console.WriteLine("NA");
13 else
14 Console.WriteLine(ra.Get(Asn.Resume).ToShortDateString());
15}
In this example, the code iterates through assignments in the project, retrieves stop and resume dates, and prints them. This allows developers to programmatically check whether tasks have been paused or resumed and take appropriate action in project automation workflows.
FAQ
Q: What is the difference between Stop and Resume dates in an assignment?
- The Stop date indicates when work on the assignment was paused, while the Resume date specifies when work is scheduled to continue.
Q: How does Aspose.Tasks handle NA values for stop and resume dates?
- In the licensed version, NA values are stored as
DateTime.MinValue
. In the evaluation version, they appear as1/1/2000
.
Q: Can I modify Stop and Resume dates programmatically?
- Yes. You can set these properties directly using Aspose.Tasks for .NET and then save the updated project file.
Q: Do I need Microsoft Project installed to work with stop and resume dates?
- No. Aspose.Tasks works independently and does not require Microsoft Project.
Conclusion
In this article, we learned how to read and manage Stop and Resume dates for resource assignments using Aspose.Tasks for .NET. By programmatically controlling these properties, developers can automate project scheduling, handle paused tasks, and ensure accurate tracking of work progress in MPP or XML files.