0

I was trying to list out all documents in document library in SharePoint 2013 I have used sharepoint 2013 powershell

$site = Get-spsite  xxxx
$web = $site.Rootweb
$list = $web.Lists["Documents"]
foreach ($item in $list.items) {
   write-host $item.File.Url
}

My problem is

Documents image in Site contents

The documents in the site conents show that the documents library has 123 items, but when I run my script I am only getting 90 items. I have site collection admin privilages on the site. Any ideas on what could be going on?

1

2 Answers 2

1

According to Microsoft, "The Items property returns all the files in a document library, including files in subfolders, but not the folders themselves. In a document library, folders are not considered items."

https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.items.aspx

Is it possible you have 33 folders?

Another possibility is that the discrepancy is for files that have been uploaded but never checked in, such that only the original uploader can actually see the file. You (and your script) may not yet have access to them.

1
  • Thanks Michael, I will check with the site owner and checkin all files and compare the counts.
    – Daniel
    Commented Mar 26, 2017 at 22:51
0

Can you see the rest of documents will you be able to see from the site. The new items which are not checked in won`t visible even you are site collection admin. I had this issue and spent hours to know this.

But you can the actual items count.

Thanks, Venkat Konjeti

1
  • Thanks Venkat, I have written a script to check the files and folders and the count is exactly the same.
    – Daniel
    Commented Mar 26, 2017 at 22:50

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.