I have working code that is to iterate lots of folders in our (rather large) document archive, but one folder (which happens to have a very large amount of subfolders) does not allow me to iterate it.
Supposing I do this...
SPFolder folder = web.Folders["Documents"];
foreach (SPFolder f in folder.SubFolders)
// THIS CODE NEVER GETS CALLED?!?!
// but I see the subfolders via the front end,
// and the ItemCount for the folder says 8000
If I look at the object in the debugger, I see it has:
folder.ItemCount = 8967
folder.SubFolders.Count = 0
folder.Files.Count = 0
Any idea how this could be?? ...and how I could iterate through the subfolders?
If the "ItemCount" for the folder isn't based on subfolders or files - what is it counting? I'm wondering if this could be the wonky "SharePoint performance throttling 5000-list-item-limit" thing that's keeping me from seeing the subfolders in the SubFolders collection, but I tried upping the limit in Central Admin to no avail.
If I simply navigate to the folder via the web site, then I see all of the subfolders.