You cannot load dependent objects for more than 1000 resources. Use a filter to restrict your query

416 views Asked by At

I am trying to do something that I thought would be really simple - get a single assignment of a single enterprise resource.

My code is this:

var resource = ctx.EnterpriseResources.GetByGuid(resourceId);
ctx.Load(resource);
ctx.ExecuteQuery();

var assignment = resource.Assignments.GetByGuid(assignmentId);
ctx.Load(assignment);
ctx.ExecuteQuery();

But when I run this, I get the following error:

Too many resources: 2643. You cannot load dependent objects for 
more than 1000 resources. Use a filter to restrict your query.

The error is also described here https://social.technet.microsoft.com/Forums/azure/en-US/4fab5f62-5955-4257-af0f-a5e1fa58dca7/error-reading-project-custom-fields-via-csom-too-many-projects?forum=projectonline

But I do not understand why we get this error. We get a single resource and we try to get a single assignment for it - why does it complain about affecting more than 1000 (2643) resources?

Thanks :-)

0

There are 0 answers