Retrieve Project and all it's tasks by Id
-
08-02-2021 - |
Question
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!
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange