Pages

Friday 27 April 2018

Get All items in SharePoint List Using PowerShell


Get All items from List or Library Using Power Shell.

# Add below Reference if your using Power shell ISE  
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

# Web Url
 $WebUrl="https://My web/"
 $Web = Get-SPWeb -Identity $WebUrl

# List Name
 $ListName ="PROJECT MANAGEMENT"

# Try to get List
 $List = $web.Lists.TryGetList($ListName)

#Get Count of Items
 Write-Host "  No of item: " $list.Items.Count 
 foreach($Item in $list.Items)
 {
   # Here you can iterate Item , Such as i required URL for Each item
    Write-Host $Item.Url
 }

or 

 $WebUrl="https://cdms.pr1ma.my/dev1/jhr/P-JHR-2014-00073"
 $Web = Get-SPWeb -Identity $WebUrl
# Get List Name
 $ListItems = $Web.lists["PROJECT MANAGEMENT"]
#Get Formated Resutls

 $ListItems.items | format-table -property title,url

No comments:

Post a Comment