Forum Discussion
Bernd Verhofstadt
Jan 17, 2017Iron Contributor
C# combine multiple ListItemCollection into one
Hi Everyone, I hope someone can help me out :-) I have a list with more than 5000 items on Sharepoint Online Site. Before the list reached 5000 items, I've used the following snippet to get all ...
- Jan 18, 2017
I've found a way to get all items by using IList<ListItem> to collect all the objects of type ListItem from the ListItemCollection.
IList<ListItem> listItemsAll = new List<ListItem>(); // Loop through pages of list items //... Getting all items foreach (ListItem myListItem in listItems) { listItemsAll.Add(myListItem); } // End Loop return listItemsAll;
In this case I return a List but I only needed to change the type of list from ListItemCollection to IList<ListItem>. Everythings works as expected.
Bernd Verhofstadt
Jan 18, 2017Iron Contributor
I've found a way to get all items by using IList<ListItem> to collect all the objects of type ListItem from the ListItemCollection.
IList<ListItem> listItemsAll = new List<ListItem>(); // Loop through pages of list items //... Getting all items foreach (ListItem myListItem in listItems) { listItemsAll.Add(myListItem); } // End Loop return listItemsAll;
In this case I return a List but I only needed to change the type of list from ListItemCollection to IList<ListItem>. Everythings works as expected.