0

I'm new to SharePoint, I have been trying to retrieve a single Project and all its Tasks by doing the following:

https://servername.sharepoint.com/sites/pwa/_api/ProjectServer/Projects('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')/Tasks

I have also tried to retrieve a Project by doing this:

https://servername.sharepoint.com/sites/pwa/_api/ProjectServer/Projects('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')

This is the error that I receive:

{
    "error": {
        "code": "1000, Microsoft.ProjectServer.PJClientCallableException",
        "message": {
            "lang": "en-US",
            "value": "This project either does not exist, or has been deleted.  Only QueueJobs can be accessed from a deleted project."
        }
    } }

Which is not true because I'm able to get all the projects by doing this:

https://servername.sharepoint.com/sites/pwa/_api/ProjectServer/Projects?$top=100

Also, if I don't use the $top this is what the query returns:

{
    "d": {
        "results": []
    }
}

why is that?

I'm doing this in Postman. I have looked through the documentation and haven't come across anything. Any help is appreciated!

  • Hmm... not sure what is going on with the non-$top query returning nothing, but at least as far as your main queries go, the syntax looks correct. Have you verified that you have the correct GUID for the project ID? Also, are these projects published? If so, have you considered using the /_api/ProjectData/ endpoint? – Dylan Cristy Jan 8 at 18:01
  • @DylanCristy the GUID is the same as the one retrieved from 'all projects' so it should work. The projects are published I have tried ProjectData and this is what I get - 20010, Microsoft.ProjectServer.PJClientCallableException, GeneralSecurityAccessDenied. – d_k Jan 8 at 19:36
  • 1
    To access the ProjectData endpoint, you need to be in the Portfolio Managers group. If you're getting the ID from the results of the 'all projects' query, that certainly is odd. I wonder if you could flip the query around to use the ID as a filter, so something like /_api/ProjectServer/Projects?$filter=Id eq guid'xxxxxxx'&$select=Tasks&$expand=Tasks ? – Dylan Cristy Jan 8 at 19:47
  • @DylanCristy the $filter only works on the name of the project and not the Id. – d_k Jan 8 at 20:00
  • Are you sure? It seems like you are using Project Online, so maybe it is a difference between Project Online and on-premises (I am working with Project Server 2016 on-prem), but that query using the Id as the filter and then selecting and expanding Tasks worked for me just now in Postman. – Dylan Cristy Jan 8 at 20:03
0

You could try flipping the query around to use the Project ID as a filter, like:

/_api/ProjectServer/Projects?$filter=Id eq guid'xxxxxxxx'&$select=Tasks&$expand=Tasks
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.