Here is my OData query:

https://XXX.sharepoint.com/sites/pwa/_api/ProjectServer/Projects?$filter=Id eq guid'xxxx'&$select=Id,Name,StartDate&$expand=Tasks&$select=Tasks/Id,Tasks/Name

I also want to add $filter on the expanded object, this is what I have tried:

https://XXX.sharepoint.com/sites/pwa/_api/ProjectServer/Projects?$filter=Id eq guid'xxxx'&$select=Id,Name,StartDate&$expand=Tasks($filter=Name eq 'xyz')&$select=Tasks/Id,Tasks/Name

https://XXX.sharepoint.com/sites/pwa/_api/ProjectServer/Projects?$filter=Id eq guid'xxxx'&$select=Id,Name,StartDate&$expand=Tasks&$select=Tasks/Id,Tasks/Name&($filter=Name eq 'xyz')

https://XXX.sharepoint.com/sites/pwa/_api/ProjectServer/Projects?$filter=Id eq guid'xxxx'&$select=Id,Name,StartDate&$expand=Tasks&$filter=Name eq 'xyz'&$select=Tasks/Id,Tasks/Name

None of the above work. What am I doing wrong here?


Try using it like below:

https://XXX.sharepoint.com/sites/pwa/_api/ProjectServer/Projects?$filter=(Id eq guid'xxxx' and Tasks/Name eq 'xyz')&$select=Id,Name,StartDate,Tasks/Id,Tasks/Name&$expand=Tasks
| improve this answer | |
  • This doesn't work either. – d_k Jan 10 at 11:32
  • @d_k try taking out the parentheses around the filter. That's the only part of that query that looks suspect to me, doing $filter=Id eq guid'xxxx' and Tasks/Name eq 'xyz' along with the select and expand looks like the right way to do it to me. – Dylan Cristy Jan 10 at 15:49
  • @DylanCristy error received - "Field or property \"Name\" does not exist." – d_k Jan 10 at 16:40
  • Bummer. It may have to do with that odd way you have to get the tasks (by finding the project using a filter instead of the regular way). You might just have to get all the tasks and do the additional filtering in code on the client side. I've had to do stuff like that when dealing with local custom fields, which also behave oddly through the REST API. – Dylan Cristy Jan 10 at 17:02

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.