Stop or Resume an Assignment

Stop or Resume an Assignment

The Asn class exposes properties for reading and writing an assignment’s stop and resume date:

To see an assignment’s stop and resume dates in Microsoft Project:

  1. On the Task Usage screen, select Insert and then Column.
  2. Add the desired columns.

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// Create project instance
 2System::SharedPtr<Project> project1 = System::MakeObject<Project>(dataDir + u"ResourceAssignmentStopResumeDates.mpp");
 3    
 4// Print resource assignment's stop and resume dates
 5    
 6{
 7    auto ra_enumerator = (project1->get_ResourceAssignments())->GetEnumerator();
 8    decltype(ra_enumerator->get_Current()) ra;
 9    while (ra_enumerator->MoveNext() && (ra = ra_enumerator->get_Current(), true))
10    {
11        if (ra->Get<System::DateTime>(Asn::Stop()).ToShortDateString() == u"1/1/2000")
12        {
13            System::Console::WriteLine(u"NA");
14        }
15        else
16        {
17            System::Console::WriteLine(ra->Get<System::DateTime>(Asn::Stop()).ToShortDateString());
18        }
19        
20        if (ra->Get<System::DateTime>(Asn::Resume()).ToShortDateString() == u"1/1/2000")
21        {
22            System::Console::WriteLine(u"NA");
23        }
24        else
25        {
26            System::Console::WriteLine(ra->Get<System::DateTime>(Asn::Resume()).ToShortDateString());
27        }
28    }
29}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.