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 am using Powershell to iterate through items in a document library and when I am running the ISE debugger there are no items in my list. I can see that the list is recognized, but I do not see any items.

Here's what I am attempting:

$site = New-Object Microsoft.SharePoint.SPSite("https://site")
$web = $site.OpenWeb()
$docLib = $web.GetList("https://site/docs") 

# $docLib.Items is blank
$items = $docLib.Items

Any ideas? Thank you!

share|improve this question

When I use SPWeb.GetList() I use a relative path like:

$docLib = $web.GetList("/Web/Lists/ListName")

If the actual path to the library is https://site/docs then try:

$docLib = $web.GetList("/docs")
share|improve this answer

Try this:

$docLib = Get-SPList -URL "https://site" -Title "DocLib Title"
$items = $docLib.Items
foreach ($item in $items)
 write-host $item.Name
share|improve this answer


$list.Items | foreach-object { $_.Name }
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.