I
Ismael
I have the next method for creating tasks into a existing project:
public void CreateTask(string ProjectID, string TaskName
, string start, string duration)
{
try
{
Guid projectGuid = new Guid(ProjectID);
Guid sessionGuid = Guid.NewGuid();
const string SESSION_DESC = "description";
project.CheckOutProject(projectGuid, sessionGuid, SESSION_DESC);
dsProject = new
w2003wss1.ProjectDataSet(); w2003wss1.ProjectDataSet.TaskRow taskRow =
dsProject.Task.NewTaskRow();
Guid taskGuid = Guid.NewGuid();
taskRow.PROJ_UID = projectGuid;
taskRow.TASK_UID = taskGuid;
taskRow.TASK_NAME = TaskName;
taskRow.TASK_START_DATE = DateTime.Parse(start);
taskRow.TASK_DUR = Convert.ToInt32(duration);
taskRow.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.EstHour;
dsProject.Task.AddTaskRow(taskRow);
Guid jobGuid = Guid.NewGuid();
bool validateOnly = false;
project.QueueUpdateProject(jobGuid, sessionGuid, dsProject, validateOnly);
System.Threading.Thread.Sleep(5000);
jobGuid = Guid.NewGuid();
project.QueueCheckInProject(jobGuid, projectGuid, false, sessionGuid,
SESSION_DESC);
}
catch (Exception e)
{
throw e;
}
}
When CheckOutProject() method is executed, an exception appears:
System.Web.Services.Protocols.SoapException: ProjectServerError(s)
LastError=CICOCheckedOutInOtherSession Instructions: Pass this into
PSClientError constructor to access all error information
at
Microsoft.Office.Project.Server.WebService.Project.CheckOutProject(Guid
projectUid, Guid sessionUid, String sessionDescription)
What happen? How can I solve this problem?
public void CreateTask(string ProjectID, string TaskName
, string start, string duration)
{
try
{
Guid projectGuid = new Guid(ProjectID);
Guid sessionGuid = Guid.NewGuid();
const string SESSION_DESC = "description";
project.CheckOutProject(projectGuid, sessionGuid, SESSION_DESC);
dsProject = new
w2003wss1.ProjectDataSet(); w2003wss1.ProjectDataSet.TaskRow taskRow =
dsProject.Task.NewTaskRow();
Guid taskGuid = Guid.NewGuid();
taskRow.PROJ_UID = projectGuid;
taskRow.TASK_UID = taskGuid;
taskRow.TASK_NAME = TaskName;
taskRow.TASK_START_DATE = DateTime.Parse(start);
taskRow.TASK_DUR = Convert.ToInt32(duration);
taskRow.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.EstHour;
dsProject.Task.AddTaskRow(taskRow);
Guid jobGuid = Guid.NewGuid();
bool validateOnly = false;
project.QueueUpdateProject(jobGuid, sessionGuid, dsProject, validateOnly);
System.Threading.Thread.Sleep(5000);
jobGuid = Guid.NewGuid();
project.QueueCheckInProject(jobGuid, projectGuid, false, sessionGuid,
SESSION_DESC);
}
catch (Exception e)
{
throw e;
}
}
When CheckOutProject() method is executed, an exception appears:
System.Web.Services.Protocols.SoapException: ProjectServerError(s)
LastError=CICOCheckedOutInOtherSession Instructions: Pass this into
PSClientError constructor to access all error information
at
Microsoft.Office.Project.Server.WebService.Project.CheckOutProject(Guid
projectUid, Guid sessionUid, String sessionDescription)
What happen? How can I solve this problem?