From my SP library, I would need to retrieve a list of meetingID grouped by MeetingID. I tried several attempts with CAML but it didn't work:
CamlQuery query = new CamlQuery(); query.ViewXml = @"<View> <Query> <Where> <And> <And> <Eq> <FieldRef Name='FSObjType'/> <Value Type='Counter'>0</Value> </Eq> <Geq> <FieldRef Name='Modified'/> <Value IncludeTimeValue = 'TRUE' Type = 'DateTime'>2016-01-01T15:55:52Z</Value> </Geq> </And> <IsNotNull> <FieldRef Name='Title' /> </IsNotNull> </And> </Where> <GroupBy Collapse='True'> <FieldRef Name='MeetingID' /> </GroupBy> <OrderBy> <FieldRef Name='DocID' /> </OrderBy> </Query> <ViewFields> <FieldRef Name='MeetingID'/> </ViewFields> </View>"; ListItemCollection items = list.GetItems(query); cc.Load(items, o => o.Include(p => p["MeetingID"])); cc.ExecuteQuery();
Considering that the CAML is returning the MeetingID and plenty of system fields, I had to use the
Include syntax. However,on my 1500 items in SP, none of them have been grouped (I should have only 50 unique MeetingID). Again probably related to the system fields which prevent the grouping to occur...
I also tried:
cc.Load(items, o => o.Include(p => p["MeetingID"]).GroupBy(g=>g["MeetingID"]));
But this one return an error...
I also tried to see if a property similar to
ViewFieldsOnly exist in CSOM but it doesn't seem to be the case.
Your help will be appreciated