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

The Following code write all the items from the list to CSV file.

$list.Items| foreach {
            $obj = New-Object PSObject -Property @{
                     "Title" = $_["Title"]
                     "Name" = $_["Name"]
                     "Modified Date" = $_["Modified"]
                     "Modified By" =$_["Modified By"]
                     "Size"= $_["File Size"]
                     "Path" = $web.Url + "/" + $_.File.Url

    }
    $exportlist += $obj
    $exportlist | Export-Csv -path $destinationfolder/'Folder.csv' -noType
    }

How to write only items contain in particular folder into CSV file. For example I have folder name Test inside my document library.folder contains many documents.i just want items which are inside Test into CSV file and not the whole list items.

share|improve this question
up vote 3 down vote accepted

Create SPQuery object and set its Folder property and then call GetItems on List and finally loop through the item collection.

$spQuery = New-Object Microsoft.SharePoint.SPQuery
$spQuery.Folder = $folder;
$items = $list.GetItems($spQuery);
share|improve this answer
    
Thanks Nadeem.learning lot from You – SharePointHacker Mar 10 '14 at 9:40

Your Answer

 
discard

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.