Frage

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 :)

LMW

War es hilfreich?

Lösung

Items + Folder count

Can you check out whether SPFolder.Itemcount could help to get the number of items in a list including the subfolders? - http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder_members.aspx

Only Item Count

Then checking the SPListItemCollection.Count will give you the list items excluding the folders. - http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitemcollection_members.aspx

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top