We have code like this:

        List list = clientContext.Web.Lists.GetByTitle("TestLib");
        ListItemCollection items = list.GetItems(query);
        clientContext.Load(items, its => its.Where(i => i.HasUniqueRoleAssignments).Include(i => i.Folder.Name, i => i.Folder.ServerRelativeUrl));

Important part is using "Where" with which we want to get only items with broken permissions inheritance. Query and included fields are not important right now. Question is: how does this actually works? Are items filtered on server side and we'll receive just the items we need or in background CSOM will load all items from SP server and executes LINQs "Where" on client side? While we are dealing with quite big amount of data, it is important to know. If the second option is true, is there some other way? Thanks.

1 Answer 1


I had to do something similar recently, this worked for me:

foreach (var list in lists)
  string listName = list.Title;
  CamlQuery camlQuery = new CamlQuery();
  camlQuery.ViewXml = "<View Scope=\"RecursiveAll\"><RowLimit>1000</RowLimit></View>";

  ListItemCollection collListItem = list.GetItems(camlQuery);
         items => items.Where(
            item => item.HasUniqueRoleAssignments == true).
                item => item.Id,
                item => item.DisplayName,
                item => item.HasUniqueRoleAssignments));


  foreach (ListItem listItem in collListItem)
    txtResults.AppendText(string.Format("ID: {0} Display Name: {1}", listItem.Id, listItem.DisplayName) + Environment.NewLine);
  • 1
    Yes, it's basically the same thing as I did. I assume you included paging to eventually get all items. It's a shame that MS provided possibility to limit fields via view, but we can't actually query items using their properties (like HasUniqueRoleAssignments). I did som testing and my conclusion is that even if you use "Where" to filter out items, this is not done on server side. SP will actually grab all items and after that performs filtering on client side.
    – Diomos
    Apr 28, 2016 at 14:22

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.