Tasks hours using PSI

V

virsharma

How to provide the duration in hours format for an individual task using PSI
programmatically?

For example if I want to assign 5 hours to a task how it can be done? Is
this possible?
 
P

Piet Remen

Hello Virsharma. If you have not done so already, download the Project Server
SDK and take a look at the ProjTool solution sample code. Take a look at the
CreateProjects.cs form and in particular a method called "btnCreate_Click"
and "CreateTask" which i hope will at least point you in the right direction.

Sample of the CreateTask method :

public static void CreateTask(ProjectWebSvc.ProjectDataSet dataset,
string name, Guid taskGuid)
{
ProjectWebSvc.ProjectDataSet.TaskRow taskRow =
dataset.Task.NewTaskRow();
taskRow.PROJ_UID = dataset.Project[0].PROJ_UID;
taskRow.TASK_UID = taskGuid;

// Specify TASK_DUR_FMT to avoid potential problems
// when you open the project with Project Professional.
taskRow.TASK_DUR_FMT = (int)PSLib.Task.DurationFormat.Day;
taskRow.TASK_NAME = name;
dataset.Task.AddTaskRow(taskRow);
//Assign the work hours
taskRow.TASK_WORK = 6;
//Or alternatively assign a value to duration
taskRow.TASK_DUR = 6;
}


Piet Remen
Solutioin Specialist
Strategic Data Management
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top