The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Hi.
First, about the Threshold - you will get an error if SP either calculates that the result is bugger than 5000 items, or if SP needs to query more than 5000 items to determine the result. So, for instance, if you have a query with unindexed rows that will return one item, you will still hit the Threshold error.
There are two different options that can work for you. The recommended one is to use RenderrListAsStream method that returns result with any threshold issues. It's more complicated than the simple API to load items but is well worth it.
Theo other option is to carefully edit the caml query. I did it with web-serices at the time & the goal is to create an empty query - withou any 'where' clause at all (if my memory serves me correctly).
Good luck!