Just for clarifying, I have written following two lines in Powershell script and see output as:

$web = Get-SPWeb http://intranet;

$list = $web.GetList("documents");
$items = $list.items;

i see these out puts in Powershell

$list.itemcount returns 56 but $items.count returns 23, why ?

2 Answers 2




The value of the ItemCount property includes folders within a document library, as well as files within subfolders. The value of the Count property of the SPListCollection class does not include folders.


Gets the number of list items in the collection, excluding folders.


Although it's clear there, that the folders are included with ItemCount, but not for Items.Count, there is another more subtle difference - if you are running code in a user context, you will see that the Items collection is security- trimmed, and its count is therefore only for those items the user can see. On the other hand, ItemCount does not appear to be security trimmed.


ItemCount is faster because it gets a static SPList property instead of building the SPListItemCollection object before counting its members.


SPList.ItemCount is not the same as SPList.Items.Count

  • +1 for pointing out that the item collection is security trimmed, very important to keep in mind. Commented Nov 19, 2014 at 14:58

$list.itemcount counts the folders also

while $items.count counts the list items

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.