Using PSI to change the resource assigned to tasks RRS feed

  • Question

  • I've used PSI to create task assignments for resources using Assignment.AddAssignmentRow on newly created projects, followed by a QueueAddToProject to update the project with the newly created rows (passing only GetChanges(System.Data.DataRowState.Added), there are examples of that floating around out there).

    My problem now is I need to programmatically 're-assign' some tasks in some projects.  My idea was to use AddAssignmentRow to add the new assignment after doing a RemoveAssignmentRow to remove the old assignment.

    My QueueAddToProject seems to be working, but where I'm stumbling is what to use to ensure the 'deletes' are updated.

    QueueUpdateProject or QueueDeleteFromProject?  Is RemoveAssignmentRow part of DataRowState.Deleted or DataRowState.Modified?

    Thursday, May 26, 2011 1:22 PM

All replies

  • Well, I found this:

    And it works that way (using QueueDeleteFromProject and 'not' RemoveAssignmentRow), but then it raises the question:

    What is RemoveAssignmentRow, and when would you use it instead of QueueDeleteFromProject?

    Thursday, May 26, 2011 3:12 PM
  • RemoveAssignmentRow only deletes a row from an AssignmentDataRowDataTable, you still have to call QueueUpdateProject after deleting the row and pass to it the ProjectDataSet containing your assignments table. On the other side, QueueDeleteFromProject deletes the rows directly. 

    RemoveAssignmentRow works with your local dataset that you later pass to Project Server to update while QueueDeleteFromProject is a PSI call that tells directly to Project Server what to delete.

    To your original question, both should work and RemoveAssignmentRow should change the row state to deleted (but only in your local dataset until you send it to PS with an update call).

    Saturday, May 28, 2011 1:11 AM