none
Project 2013 REST API - getting all tasks assigned to a user RRS feed

  • Question

  • I'm trying to get all tasks assigned to a user to display something like you would see in "My Tasks" using the REST API.

    I found this: http://social.technet.microsoft.com/Forums/projectserver/en-US/a5d8760d-8e27-432b-8187-592cadf302ae/get-my-tasks-tasks-via-rest-api-or-web-services?forum=sharepointdevelopment

    But it doesn't seem to pertain to Project 2013.

    Any idea on how I could do this?

    As an aside, I'm having some trouble with finding guidance in the documentation. Are there any Project 2013 developer resources that break things down a little more than the SDK? Everything I've found is pretty Sharepoint-centered, not really getting into the specifics of Project.

    Thursday, May 29, 2014 2:34 PM

Answers

  • Check the samples folder which gets installed with SDK, there you will find some samples, however may not be the REST but with CSOM you could try something like this, i am sure you would be able to convert this pretty easily, in case required

    projContext = new ProjectContext(pwaPath);
                var PrjList = projContext.LoadQuery(projContext.Projects.Where(Prj => Prj.Name == newProjName));
                projContext.ExecuteQuery();
                var GotPrj = PrjList.First();
    
                    //DraftProject projCheckedOut = GotPrj.CheckOut();
                    projContext.Load(GotPrj.Tasks);
                    projContext.ExecuteQuery();
    
                    foreach (var tsk in GotPrj.Tasks)
                    {
                        this.textBox1.Text += Environment.NewLine + "Task Name: " + tsk.Name + " || Task Work: " + tsk.Work +" || Task Remaining Work: " +tsk.RemainingWork;
                        projContext.Load(tsk.Assignments);
                        projContext.ExecuteQuery();
    
                        foreach (var tskAssgn in tsk.Assignments)
                        {
                            projContext.Load(tskAssgn.Resource);
                            projContext.ExecuteQuery();
                                                  
                                this.textBox1.Text += Environment.NewLine + tskAssgn.Resource.Name + "--Res ID--" + tskAssgn.Resource.Id +
                                    "----Assgn ID: " + tskAssgn.Id + " || Actual Work: " + tskAssgn.ActualWork + 
                                    " || Assgn Remaining Work: " + tskAssgn.RemainingWork
                                    + " || Assgn minDate: " + tskAssgn.Start
                                    + " || Assgn maxDate: " + tskAssgn.Finish
                                    ;
    }
    }
                


    Thanks | epmXperts | http://epmxperts.wordpress.com

    • Marked as answer by Sean Gibat Friday, May 30, 2014 2:58 PM
    Thursday, May 29, 2014 2:58 PM
    Moderator

All replies

  • Check the samples folder which gets installed with SDK, there you will find some samples, however may not be the REST but with CSOM you could try something like this, i am sure you would be able to convert this pretty easily, in case required

    projContext = new ProjectContext(pwaPath);
                var PrjList = projContext.LoadQuery(projContext.Projects.Where(Prj => Prj.Name == newProjName));
                projContext.ExecuteQuery();
                var GotPrj = PrjList.First();
    
                    //DraftProject projCheckedOut = GotPrj.CheckOut();
                    projContext.Load(GotPrj.Tasks);
                    projContext.ExecuteQuery();
    
                    foreach (var tsk in GotPrj.Tasks)
                    {
                        this.textBox1.Text += Environment.NewLine + "Task Name: " + tsk.Name + " || Task Work: " + tsk.Work +" || Task Remaining Work: " +tsk.RemainingWork;
                        projContext.Load(tsk.Assignments);
                        projContext.ExecuteQuery();
    
                        foreach (var tskAssgn in tsk.Assignments)
                        {
                            projContext.Load(tskAssgn.Resource);
                            projContext.ExecuteQuery();
                                                  
                                this.textBox1.Text += Environment.NewLine + tskAssgn.Resource.Name + "--Res ID--" + tskAssgn.Resource.Id +
                                    "----Assgn ID: " + tskAssgn.Id + " || Actual Work: " + tskAssgn.ActualWork + 
                                    " || Assgn Remaining Work: " + tskAssgn.RemainingWork
                                    + " || Assgn minDate: " + tskAssgn.Start
                                    + " || Assgn maxDate: " + tskAssgn.Finish
                                    ;
    }
    }
                


    Thanks | epmXperts | http://epmxperts.wordpress.com

    • Marked as answer by Sean Gibat Friday, May 30, 2014 2:58 PM
    Thursday, May 29, 2014 2:58 PM
    Moderator
  • Thanks for this. I also found the QuickStatus example app very helpful. In fact, it does precisely what I was asking in this post.
    Friday, May 30, 2014 2:58 PM