don'tDon't raise the list view threshold (LVT) to something greater than 5000 (default), as it does not address the real issue. You'd just end up raising it more and more as your list(s) grow and end up causing performance issues.
Instead, use the ListItemCollectionPositionListItemCollectionPosition
of a CAML query to get all of the list items without running into an error. Use thethis link below and look at the MSDN-provided example. Change the RowLimitRowLimit
(example has it set to 2) to something like 1000 as that will determine the batch size for selecting list items from your list.