Akshay

Akshay

  • NA
  • 82
  • 46.6k

Group by in c# for Document Directory having Column contain

Dec 22 2014 1:43 AM

I have Document library which has Document Content type and a Column named Engagement , whose values are populated from term store.
Engagement Column value:
  • AAA
  • BBB
  • CCC
  • DDD

Now my requirement is to group all records by Engagement Column value
My ref code: //Column Field Name private string _EI_Field_Name = "Engagement_x0020_and_x0020_Inclusion_x0020_Document"; List listItems = list.Items.Cast().ToList(); if (listItems.Count > 0) { var groupedItems = listItems.GroupBy(a => a[_EI_Field_Name]).ToDictionary(g=>g.Key);
foreach (var groupItem in groupedItems) { foreach (var groupValue in groupItem) {
} } }