0

So I've read all the whitepapers, and I know that you can store up to 5 million list items in a list as long as you use folders.

What I'm after, is, has anyone written some nice recursion that gets a list, looks at all the folders in the list, and assigns list items either to a <2000 folder, or creates a new folder if one does not exist, and then stores list items there?

Same thing with list item retrival. Does anyone have a nice clean and fast method for getting all list items from a list <2000 at a time?

I've looked on google and here and haven't found a nice definitive guide for storing and retrieving list items from large lists with code samples, it's all been about the theory from what I can see.

1 Answer 1

4

That is because the operations you mentioned are all performed the exact same way as with smaller lists. My take is:

  1. Always use SPQuery (single list query) or SPSiteDataQuery (along with CrossListQueryCache) for cross-list query (in the same site collection) or CoreSearchResults (or KeywordQuery for direct call) to get across Site Collections.
  2. Use the same SPQuery to retrieve only those items you are interested in and once received make sure it is a FOLDER (by retrieve its Folder property and check for NULL) and start creating list items passing to it - others use the RootFolder to start writing in the root of the list.

In addition to that there are really many examples to write to lists which should serve your purpose with the above. Let me know if you need more details or examples.

Hope it helps, C:\Marius

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.