问题描述
任何人都可以使用asmx服务共享项目服务器中创建,更新和删除任务的任何示例代码。
Can anyone share any sample code for create, update and delete tasks in project server using asmx service.
谢谢,¥b $ b Jeneesh。
Thanks,
Jeneesh.
推荐答案
我假设您正在寻找项目服务器2010版本
I assume you are looking for project server 2010 version
希望下面的代码 使用ASMX将有帮助
Hope below code using ASMX will helps
ProjectWebSvc.ProjectDataSet projectDs = new ProjectWebSvc.ProjectDataSet( ); $
Guid jobId;
//创建项目。
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);
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);
//添加一些任务。
ProjectWebSvc.ProjectDataSet.TaskRow taskOne = projectDs.Task.NewTaskRow();
taskOne.PROJ_UID = projectRow.PROJ_UID;
taskOne.TASK_UID = Guid.NewGuid();
//必须指定任务持续时间格式。
taskOne.TASK_DUR_FMT =(int)PSLibrary.Task.DurationFormat.Day;
taskOne.TASK_DUR = 4800; // 8小时的持续时间单位(分钟/ 10)
taskOne.TASK_NAME =" Task One"; $
taskOne.TASK_START_DATE = System.DateTime.Now.AddDays(1);
projectDs.Task.AddTaskRow(taskOne);
// 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();
//必须指定任务持续时间格式。
taskTwo.TASK_DUR_FMT =(int)PSLibrary.Task.DurationFormat.Day;
taskTwo.TASK_DUR = 4800; // 8小时的持续时间单位(分钟/ 10)
taskTwo.TASK_NAME ="任务二"; $
taskTwo.TASK_START_DATE = System.DateTime.Now.AddDays(1);
projectDs.Task.AddTaskRow(taskTwo);
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);
//将项目保存到数据库。
jobId = Guid.NewGuid();
projectSvc.QueueCreateProject(jobId,projectDs,false);
// Save the project to the database.
jobId = Guid.NewGuid();
projectSvc.QueueCreateProject(jobId, projectDs, false);
您可以在Project SDK中找到更多示例
you can find more examples in Project SDK
问候
Santosh
这篇关于在项目服务器中添加/更新/删除任务。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!