Get List Items from SharePoint View in PowerShell

Requirement: Get all list items from a SharePoint view in PowerShell
sharepoint powershell get items in listview

SharePoint PowerShell to Get Items in List view
Here is the PowerShell script example to get list items from a SharePoint view:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$ListName = "Invoice"
$ViewName = "2014 Invoice"

#Get Web and List objects
$web = Get-SPWeb $SiteURL
$list = $web.Lists[$ListName]

#Get the View
$view = $list.Views[$ViewName]

#Get All Items from the View
$items = $list.GetItems($view)

foreach($item in $items)
    write-host $item["Title"]

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.