Forum Discussion
Sunil Guntupalli
May 13, 2018Copper Contributor
Project Server - StatusingInvalidInterval error when trying to add assignment to a task using CSOM
Hi,
Project Server 2016 - I have requirement of adding new resource assignments to a task using CSOM which should go for PM approval. I know how to add assignments directly to a Task using CSOM but that doesn't go to PM for approval.
So i did some research and found a way to do this. The code is working fine when i try to add first resource assignment on the task and the assignment is routed for PM approval but the same code is failing with "StatusingInvalidInterval" error when i try to add second resource assignment on the same task.
var resource = m_ProjectContext.EnterpriseResources.GetByGuid(m_ID);
m_ProjectContext.Load(resource, r => r.Assignments);
m_ProjectContext.ExecuteQuery();
StatusAssignment statusAssignment = resource.Assignments.Add(new StatusAssignmentCreationInformation()
{
Comment = string.Format("Assignment created on {0}", DateTime.Now),
Id = new Guid(),
ProjectId = projectId,
Task = new StatusTaskCreationInformation()
{
Id = taskId
,Start = startDate
,Finish = finishDate
}
});
statusAssignment.SubmitStatusUpdates(string.Format("Assignment created on {0}", DateTime.Now));
m_ProjectContext.ExecuteQuery(); //i am receiving the error here
I did lot of research but couldn't find a clue at all.
Anyone had the similar issue ? or any help is much appreciated.
Regards,
Sunil G.
No RepliesBe the first to reply