我正在开发 OnPublished 事件处理程序,它将根据另一个字段的更改更新项目的一个自定义字段。
我收到一个错误
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);
与我们在项目处于签入状态时运行代码的其他答案不同,我们正在签出并分配新的 SessionID。但是当事件处理程序触发时,项目已经被签出。那么如何获取 SessionID。我认为这就是代码被破坏的地方。