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 have following powershell:

    $webUrl = 'http://demo2010a:90/sites/Contracts'
    $web = Get-SPWeb $webUrl;
    $lists = $web.GetListsOfType($SPBaseTypeDocumentLibrary);
    foreach ($list in $lists)
    $folders = $list.Folders
    foreach ($spFolder in $folders)

        #$item = $spFolder.Item
        $item = [Microsoft.SharePoint.SPListItem]::$spFolder.Item
        if ($item -eq $null)
            Write-Host "Null found"


The problem is I can't seem to get SPListItem from SPFolder

share|improve this question
up vote 3 down vote accepted

You are getting it. $list.Folders is a collection of SPListItems so $spFolder is already a SPListItem. Just $item = $spFolder is enough.

SPListItem.Item is used to get or set the value that is contained by the specified field.

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.