importWorkPlanTasks
Purpose
This operation creates and imports all the tasks to the work plan for a specified project.
Function
This operation requires that the specified project not have a work plan created. If a work plan already exists, a SOAP fault is returned to the client. In this operation, you do not need to specify actual values in TaskActualType. Instead, actual values should be specified in the assignment for each resource. The assignment actual values are then finally rolled up to the task.
Input
The following inputs are required:
-
One of the following:
-
Project ID
-
Project name
-
-
TaskType details with the following required information:
-
Task name
-
Task sequence number
-
Task outline level
-
Task schedule information
-
Return
If the operation is successful, a list of task sequence and task IDs corresponding to the tasks that are newly imported to the work plan is returned.
Java Examples
String projectName = "Project 1";
ImportWorkPlanTasksDocument impWPDoc = ImportWorkPlanTasksDocument.Factory.newInstance(); ImportWorkPlanTasks impWP = impWPDoc.addNewImportWorkPlanTasks(); WorkPlanInputType wpit = impWP.addNewWorkPlanInput();
// Set the value for WorkPlanInput element's projectName wpit.setProjectName(projectName);
// Create and add an empty tasks element TaskType task1 = impWP.addNewTasks();
// Set required properties for task task1.setOutlineLevel(2); task1.setTaskSequence(1); task1.setTaskName("pm ws test importTask1" + uniqueSuffix);
// create and add task scheduling bean to task. ScheduleInfo sif = task1.addNewSchedulingBean(); sif.setScheduledDuration(4); sif.setScheduledEffort(34); sif.setScheduledStart(taskScheduleStart); sif.setScheduledFinish(taskScheduleFinish); sif.setConstraintType(ConstraintType.AS_SOON_AS_POSSIBLE);
AssignmentType assignment = task1.addNewWorkUnits(); // Add resource to assignment ResourceType resource = assignment.addNewResource(); resource.setResourceId(resourceId2.longValue());
assignment.setScheduledEffort(10); assignment.setActualEffort(0); assignment.setEstimatedRemainingEffort(10); assignment.setPercentComplete(0);
// Create and add another empty tasks TaskType task2 = impWP.addNewTasks(); … // Info for task2
// Calling service ImportWorkPlanTasksResponseDocument impResponseDoc = stub.importWorkPlanTasks(impWPDoc);
// Check the response and make sure we are getting it back ok AddTaskResultType[] addedTasks = impResponseDoc.getImportWorkPlanTasksResponse().getReturnArray( );