SharePoint PowerShell - How to get list item by ID using GetItemById


Posted on : Mon, 14th Sep 15 05:25 pm (Updated on : Mon, 14th Sep 15 05:25 pm) UTC
Author : Code2care
100+ votes

How to get SPListItem via PowerShell using GetItemById()

Use below PowerShell command to retrieve SharePoint List Item using the Item ID. This uses GetItemById() which takes in the ItemId as parameter.
You can modify below code for other requirements but the core logic remains same.

Name : Get SharePoint ListItem using GetItemById()
  

$web = Get-SPWeb <SITE URL>
$list = $web.GetList("<LIST NAME>")
$list.GetItemById(<ITEM ID>)
  

where,

SITE URL = URL of SharePoint Site (string)
LIST NAME = Name of SharePoint List (string)
ITEM ID = Number of Item Id (integer)

Code2care's mission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.

Follow us : Facebook - Twitter - Google +