title: Project Server 2010 Event Handler
body: <p>I am working on OnPublished event handler that will update one custom field of a project based on change in another field.</p>
  
  <p>I am getting an error</p>
  
  <pre><code>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
  </code></pre>
  
  <p>This is the code</p>
  
  <pre><code>        //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);
  </code></pre>
  
  <p>Unlike other answers where we are running the code when the project is in checked-in state, we are checking-out and assigning new SessionID.
  But when the event handler fires, the project is already is checked-out. So how do I get the SessionID. I think that is where the code is breaking.</p>