我对OnPublished事件处理程序,将更新基于另一个场变化项目的一个自定义字段的工作。Project Server 2010的事件处理程序
我得到一个错误
Event Handler for event \ProjectPublished\ of type \PS.UpdateProjectStatusChangeDate.EventHandlerUpdateField\ threw an exception: ProjectServerError(s) LastError=CICOCheckedOutToOtherUser Instructions: Pass this into PSClientError constructor to access all error information
这是代码
//loading project data from server
//Every change on this dataset will be updated on the server!
ProjectDataSet projectDs = projectClient.ReadProject(projectId, projectSvc.DataStoreEnum.WorkingStore);
foreach (projectSvc.ProjectDataSet.ProjectRow row in projectDs.Project)
{
if (row.PROJ_SESSION_UID != null)
{
sessionId = row.PROJ_SESSION_UID;
break;
}
}
//send the dataset to the server to update the database
bool validateOnly = false;
Guid jobId = Guid.NewGuid();
projectClient.QueueUpdateProject(jobId, sessionId, projectDs, validateOnly);
不像其他的答案,我们正在运行的代码时,该项目是在签入的状态,我们checking-出并分配新的SessionID。 但是,当事件处理程序触发时,项目已经被检出。那么如何获得SessionID。我认为这就是代码破裂的地方。
感谢您的回答@melan。在我的情况下,用户使用Project Pro和PWA,比如50-50。为已发布的项目设置一个标志 - 这件事已经超越了我的想法,但从来没有找到任何方法来做到这一点。 – sid1385 2013-03-05 12:56:29