i had a business case that i had to checkin,checkout the project by PSI in the work flow but when i check out the project i cant continue the work flow stages the PWA writes that iam check out the project in another session and i need to continue the work flow from the PWA? any help or suggestion
Asked
Active
Viewed 1,463 times
1 Answers
1
Do you reset your sessionId? You have to store it during the whole process. Here is a short example:
//set guids for session and job
Guid sessionId = Guid.NewGuid();
Guid jobId = Guid.NewGuid();
//checkout in the current session
projectSvc.CheckOutProject(ProjectId, sessionId, "custom field update checkout");
//do something (for example, update a project) with the same sessionId!
bool validateOnly = false;
projectSvc.QueueUpdateProject(jobId, sessionId, project, validateOnly);
//simply wait, if you don't use queuing services
System.Threading.Thread.Sleep(4000);
//create a new job ID for the checkin, sessionId stays the same as before!
jobId = Guid.NewGuid();
//checkin the project
bool force = false;
string sessionDescription = "updated custom fields";
projectSvc.QueueCheckInProject(jobId, ProjectId, force, sessionId, sessionDescription);
//wait again (very ugly)
System.Threading.Thread.Sleep(4000);
Check my answer here: Setting custom fields using the PSI - Microsoft Project Server