I know I'm able to get RoleAssignments in my call to get a ListItemCollection, e.g.

context.Load(items, x => x.Include(y => y.RoleAssignments));

Is there a way to also load each RoleAssignments' RoleDefinitionBindings in the same call to the server? Can I extend the Includes in some way?

1 Answer 1


That one should do it:

context.Load(items, iCol => iCol.Include(
                item => item.RoleAssignments,
                item => item.RoleAssignments.Include(ra => ra.RoleDefinitionBindings)));
  • Thanks, that's great and helps me to understand the Include method better too.
    – sasfrog
    Jan 24, 2017 at 0:22
  • Hey @Evariste, is it possible to filter within the Include request, for example if I want only role assignments with a specific attribute value, can I include that within the lambda?
    – sasfrog
    Jan 24, 2017 at 6:31
  • 1
    I don't think that's possible at request time. Even if you use a Where in the LINQ request, the filtering actually happens client-side, thus there's no improvment in doing it in the Load over doing it after getting the collection, with a classic foreach loop.
    – Evariste
    Jan 24, 2017 at 6:41
  • Thanks so much for that. You've been really helpful. Cheers
    – sasfrog
    Jan 24, 2017 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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