SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to find out how many subitems and subfolders a SPListItem has. The fields ItemChildCount and FolderChildCount are no solution for me, because they only count the folder/item directly beneath the ListItem. I need ALL items and folders.

Is there a way to get these numbers without iterating through the complete list?

Thanks in advance :)


share|improve this question
up vote 2 down vote accepted

Items + Folder count

Can you check out whether SPFolder.Itemcount could help to get the number of items in a list including the subfolders? -

Only Item Count

Then checking the SPListItemCollection.Count will give you the list items excluding the folders. -

Difference of both might give you the number of folders in the list. I couldnt find a direct method to get all the folders and subfolders in a list.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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