I use SP Client and want to return ListItemCollection which will be filled with items from specific view which I choose. I get ViewQuery string by sending view index in viewcollection. Problem is in part where I send camlQuery to GetItems method "ListItemCollection listItems = list.GetItems(camlQuery);" because whatever camlquery is sent to GetItems I allways get ALL items from list instead of FILTERED ones, despite the fact that camlquery string are good and different every time. Any suggestion?
clientContext.ExecuteQuery();
List list = site.Lists.GetByTitle(SPList);
clientContext.Load(list);
clientContext.ExecuteQuery();
ViewCollection viewItems = list.Views;
clientContext.Load(viewItems);
clientContext.ExecuteQuery();
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = list.Views[index].ViewQuery;
ListItemCollection listItems = list.GetItems(camlQuery);
clientContext.Load(listItems);
clientContext.ExecuteQuery();