none
Remove resource from Project Team in Project Server 2013 using CSOM RRS feed

  • Question

  • Hi,

    Can anyone provide me the code for removing the Enterprise resource from the build team.

    I have tried using the code for the same using PSI and CSOM, but none of them seems to work.

    Regards,

    Divyang Agrawal

    Friday, October 11, 2013 4:37 AM

Answers

  • Haven't tried it in 2013 CSOM yet, but with 2010 PSI its pretty simple and works as below, i as far as i think, CSOM even calls PSI in backend, hence ideally the code below should work in 2013

    its working for me in 2010

    SvcProject.ProjectClient PrjClient = SetPrjClientEndPoints();
                Guid PrjUid = new Guid("660385e2-0000-XXX-b282-d034c8ee2f62");
    
                SvcProject.ProjectTeamDataSet PrjTsDS = new  ProjectTeamDataSet();
    
                PrjTsDS = PrjClient.ReadProjectTeam(PrjUid);
                this.dataGridView1.DataSource = PrjTsDS.Tables[0];
                PrjTsDS.Tables[0].Rows[0].Delete(); // Selecting randomly the first user 
                Guid SessionID = Guid.NewGuid();
                PrjClient.CheckOutProject(PrjUid, SessionID, "Checkout for editing project team");
                PrjClient.QueueUpdateProjectTeam(Guid.NewGuid(), SessionID, PrjUid, PrjTsDS);
                PrjClient.QueueCheckInProject(Guid.NewGuid(), PrjUid, true, SessionID, "Checking in post team update");
    


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Sunday, October 20, 2013 2:33 AM
    Moderator

All replies

  • can you explain a little bit more ? as build team brings up the entire resource pool and tahts where you select your resources for your project, and what i am understanding is you are trying to remove users from build team, which essentially means you want to remove the users from resource pool, correct me if i am wrong

     

    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Saturday, October 12, 2013 2:30 PM
    Moderator
  • Hi Sunil,

    Thanks for the response.

    The issue I am having is slightly different from what you inferred.

    I am facing an issue with removing the resource from the Project Build Team.

    Below is the detailed scenario:-

    a) I create a resource in the resource center, and then Add it to the Project Build Team using the code.

    b) Now I want to remove the resource from that Project Team, and not from the resource center, i.e. when I remove it from the team, then in the Project Build team page, it should appear in the left side(this is the page that shows resources from the resource center) and it should not be displayed on the right hand side(which displays the resource in the project build team).

    Any pointers for the above scenario would be of great help.

    Regards,

    Divyang Agrawal

    Thursday, October 17, 2013 5:43 AM
  • Haven't tried it in 2013 CSOM yet, but with 2010 PSI its pretty simple and works as below, i as far as i think, CSOM even calls PSI in backend, hence ideally the code below should work in 2013

    its working for me in 2010

    SvcProject.ProjectClient PrjClient = SetPrjClientEndPoints();
                Guid PrjUid = new Guid("660385e2-0000-XXX-b282-d034c8ee2f62");
    
                SvcProject.ProjectTeamDataSet PrjTsDS = new  ProjectTeamDataSet();
    
                PrjTsDS = PrjClient.ReadProjectTeam(PrjUid);
                this.dataGridView1.DataSource = PrjTsDS.Tables[0];
                PrjTsDS.Tables[0].Rows[0].Delete(); // Selecting randomly the first user 
                Guid SessionID = Guid.NewGuid();
                PrjClient.CheckOutProject(PrjUid, SessionID, "Checkout for editing project team");
                PrjClient.QueueUpdateProjectTeam(Guid.NewGuid(), SessionID, PrjUid, PrjTsDS);
                PrjClient.QueueCheckInProject(Guid.NewGuid(), PrjUid, true, SessionID, "Checking in post team update");
    


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Sunday, October 20, 2013 2:33 AM
    Moderator
  • Hi Sunil,

    Many thanks for your help. I was able to fix the issue with the help of above code.

    I just can't believe though, how the project is edited first, then checked out-->updated and checked in to update the team.

    The error in my code was that I was first checking out the project-->deleting the resource from team and checking in the project.

    Thanks again.

    Regards,

    Divyang Agrawal

    Will try to run the code using CSOM and post it here, if it works for me.

    Monday, October 21, 2013 7:13 AM
  • Hi Divyang

    not sure what you are referring to as editing of project ? checkout is where you get the edit lock, not sure if you are referring the Checkin as additional code, checkin is just to ensure that others can open the project in edit mode, even if you don't do checkin, as long as youa re checking out the project and updating the team, it should work fine,as a standard practice since the project is being checked out by code, hence i would check it back in

    all that matters is the below 2 lines of code

     PrjClient.CheckOutProject(PrjUid, SessionID, "Checkout for editing project team");
     
    PrjClient.QueueUpdateProjectTeam(Guid.NewGuid(), SessionID, PrjUid, PrjTsDS);

     As long as you can pass a properly formed team dataset it will update whatever is in that dataset accordingly


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Monday, October 21, 2013 11:39 AM
    Moderator