Get List Items from a SharePoint View in PowerShell

Requirement: Get all list items from a SharePoint view in PowerShell

sharepoint powershell get items in listview

PowerShell to Get Items in a SharePoint List view

When you are working with SharePoint, there are times when you need to get a list of items from a view, rather than getting all of the items in the list. Whether you’re looking to export data or just need some way to automate getting data from a SharePoint view for reporting or other purposes, PowerShell is your answer! In this post, we’re going to take a look at how you can use PowerShell to get items from a SharePoint 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"]

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

One thought on “Get List Items from a SharePoint View in PowerShell

  • Thank you for sharing the Script. Very useful as always. I am getting below strange error. Any suggestion would be appreciated.

    Cannot index into a null array.
    At line:23 char:5
    + $ExportItem | Add-Member -MemberType NoteProperty -name “Title” -value $_[“T …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray


Leave a Reply

Your email address will not be published. Required fields are marked *