none
Add / update / delete task in project server. RRS feed

  • Question

  • Hi,

    Can anyone share any sample code for create, update and delete tasks in project server using asmx service.

    Thanks,
    Jeneesh.

    Sunday, November 30, 2014 1:07 PM

All replies

  • Hi Jeneesh

    I assume you are looking for project server 2010 version

    Hope below code using ASMX will helps

    ProjectWebSvc.ProjectDataSet projectDs = new ProjectWebSvc.ProjectDataSet();
             Guid jobId;
             // Create the project.
             ProjectWebSvc.ProjectDataSet.ProjectRow projectRow = projectDs.Project.NewProjectRow();
             projectRow.PROJ_UID = Guid.NewGuid();
             projectRow.PROJ_NAME = "PSI Project " ;
             projectRow.PROJ_TYPE = (int)PSLibrary.Project.ProjectType.Project;
             projectDs.Project.AddProjectRow(projectRow);

             // Add some tasks.
             ProjectWebSvc.ProjectDataSet.TaskRow taskOne = projectDs.Task.NewTaskRow();
             taskOne.PROJ_UID = projectRow.PROJ_UID;
             taskOne.TASK_UID = Guid.NewGuid();
             // The Task Duration format must be specified.
             taskOne.TASK_DUR_FMT =(int) PSLibrary.Task.DurationFormat.Day;
             taskOne.TASK_DUR = 4800;  // 8 hours in duration units (minute/10)
             taskOne.TASK_NAME = "Task One";
             taskOne.TASK_START_DATE = System.DateTime.Now.AddDays(1);
             projectDs.Task.AddTaskRow(taskOne);

             ProjectWebSvc.ProjectDataSet.TaskRow taskTwo = projectDs.Task.NewTaskRow();
             taskTwo.PROJ_UID = projectRow.PROJ_UID;
             taskTwo.TASK_UID = Guid.NewGuid();
             // The Task Duration format must be specified.
             taskTwo.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.Day;
             taskTwo.TASK_DUR = 4800;  // 8 hours in duration units (minute/10)
             taskTwo.TASK_NAME = "Task Two";
             taskTwo.TASK_START_DATE = System.DateTime.Now.AddDays(1);
             projectDs.Task.AddTaskRow(taskTwo);

             // Save the project to the database.
             jobId = Guid.NewGuid();
             projectSvc.QueueCreateProject(jobId, projectDs, false);

    you can find more examples in Project SDK

    Regards

    Santosh

    Monday, December 1, 2014 5:57 AM