Friday, 30 October 2015

Export Sharepoint List Items to CSV.

 Add-PSSnapin Microsoft.SharePoint.PowerShell

$SPWeb = Get-SPWeb “http://server:port/Site"
$SPList = $SPWeb.Lists[“List Name”]
$exportlist = @()
$SPList.Items | foreach {
      $obj = New-Object PSObject -Property @{
      ####”CSV Column Name” – “SharePoint List Column”
       “Title” = $_[“Title”]
       “SiteURL” = $_[“URL”]
       “CreatedBy” = $_[“Created By”]
       }
    $exportlist += $obj
   
    }
$exportlist | Export-Csv -path "D:\Shares\ListBackUp.csv"
    
$SPWeb.Dispose() 

No comments:

Post a Comment