次の方法で共有


Statusing for Manually Scheduled Tasks in Project 2010 SP1

Service Pack 1 (SP1) for Project Server 2010 enables you to use the UpdateStatus method to edit timephased data for manually scheduled tasks. Before SP1, you could update status only for automatically scheduled tasks. The attached UpdateStatus_ManualTasks.zip file contains the Visual Studio 2010 solution that will be included in the next update of the Project 2010 SDK download.

The UpdateStatus_ManualTasks example is a test application that does the following, for a manually scheduled task or an auto-scheduled task:

  • Parses the project name, task name, number of hours worked, the optional assigned resource, and an optional status comment.

  • If no resource is specified, assumes the application user is assigned to the task.

  • Gets the GUID for the user assigned to the specified task.

  • Gets and validates the assignment data. Assumes only one resource is assigned.

  • Creates the changeXml string for the UpdateStatus method. For a simple test, converts reported hours to percent complete (maximum 100). If the application user specifies a different resource, adds the ResID attribute to the Assn element in the changeXml string.

  • Calls UpdateStatus, and then calls SubmitStatusForResource, for the single assignment.

  • Calls ReadStatusForResource to get an updated StatusingDataSet.

    The application also writes the datasets and the changeXml value to XML files, for use in testing.

Note: Until you install SP1, the UpdateStatus test application will work only with automatically scheduled tasks. SP1 will be available the end of June, 2011.

To use the UpdateStatus test application, do the following:

  1. Use Project Professional to create a test project, add two manually scheduled tasks, set the task duration and start date, and then add yourself and one other user as resources. Assign one task to you and the other task to the other user.

    For example, name the project Test project, name the tasks T1 and T2, and then set the duration of each task to three days. Assume your user name is User 1, and the other user is User 2. Assign T1 to User 1 and assign T2 to User 2.

  2. In the app.config file, change the WCF endpoint address for the Project Web App instance you are using.

  3. Run tests, using various parameters. See the Usage method in the attached Program.cs file for parameter information. For example, run the following tests in a Command Prompt window:

    • UpdateStatus -p "Test project" -t "T1" -hours 6 -c "This is a comment"

      The output shows:
      Updating status for User 1 on task 'T1': 6 hours
      Manually scheduled task

    • UpdateStatus -p "Test project" -t "T1" -hours 6 -r "User 2" -c "This is a comment"

      User 2 is not assigned to task T1, so the output shows:
      The assignment on task 'T1' is for User 1, not for User 2

    • UpdateStatus -p "Test project" -t "T2" -hours 6 -r "User 2" -c "This is a comment"

      The output shows:
      Updating status for User 2 on task 'T2': 6 hours
      Manually scheduled task

After each test, check the Approval Center in Project Web App for status updates.

When you add a manually scheduled task that does not have a start date or duration, the default is eight hours of work. You can still assign a resource to the task and update the status.

For example, if a task T3 has no start date or duration, and you use the UpdateStatus test application to set six hours of work for the assigned resource, Project Server sets the start date for T3 to the project start date, and then adds six hours of actual work. After accepting the status update, you can add the Actual Work column and the Remaining Work column to the Gantt Chart view in Project Professional . The work for T3 is eight hours, actual work is six hours, and remaining work is two hours.

Gantt_6hWork

If you add the Actual Work row to the Details pane in the Resource Usage view or the Task Usage view, you can also see the six hours of actual work.

ResourceUsage_6hWork

For more information about changes in SP1, see Announcing Service Pack 1 for Microsoft Project & Project Server 2010 in the Project team blog.

UpdateStatus_ManualTasks.zip