kwizcom banner advertisement

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

#Variables
$SiteUrl="http://intranet.crescent.com" 
$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"]
}
Get List Items from SharePoint View in PowerShell Get List Items from SharePoint View in PowerShell Reviewed by Salaudeen Rajack on April 16, 2014 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.