How to query and retrieve SharePoint List Item by Itemd ID using PowerShell / Management Shell / PnP PowerShell ?
There are multiple ways
GetItemById()
Get-PnPListItem (PnP)
Use below PowerShell command to retrieve SharePoint List Item using the Item ID. This uses GetItemById() which takes in the ItemId as a parameter.
You can modify the below code for other requirements but the core logic remains the same.
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)
Using PnP Get-PnPListItem
Get-PnPListItem -List [List Name] -Id [ID]Using GetItemById() for SharePoint Online
$list = $Context.web.Lists.GetByTitle("[List Name]")
$listItem = $List.GetItemById([ID])
$context.Load($listItem)
$context.ExecuteQuery()
You can further update the script further to filter and query only required columns/fields.
- Change SharePoint Online List Experience to New Experience from Classic
- Cannot load PowerApps form in SharePoint Online due to repeated authentication
- Create SharePoint list from Excel spreadsheet and import table
- [Solved] SharePoint Search Internal server error exception
- [Fix] SharePoint: This embed code doesnt seem to work. We only support iframe based embeds
- How to extend retiring SharePoint 2010 Workflows and continue with Office 365
- SharePoint Online: Editing session has ended Message
- SharePoint error cannot connect to the configuration database
- That did'nt work, Issue type User not in directory - SharePoint external access error
- How to embed web page in SharePoint
- SharePoint - The URL is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.
- SharePoint error 2130575251 - The security validation for this page is invalid and might be corrupted
- Microsoft 365: How to Turn Off Delve in SharePoint Online for All Users
- SharePoint Server 2016 error Microsoft Office Online Server 2016 cant be installed on the same machine as a Microsoft SharePoint Server product
- JSON column formatting to preview SharePoint Online file on mouse hover
- How to show Videos on SharePoint Page
- How to get SharePoint Online user details from person or group column using REST API
- How to retrieve all SharePoint Online List Items using Rest API
- How to wrap column text in SharePoint Online Modern List Grid View using JSON formatting
- Recommended size and resolution for SharePoint Online Site logo
- SharePoint List redirect user after submitting form NewForm.aspx
- Add Custom External Link to SharePoint Site Navigation
- Drag drop files here option missing for SharePoint document library
- Can Microsoft SharePoint Lists be synced and accessed offline without internet?
- SharePoint - Use Today's Date Time in list view filter and calculated column
- Add Smiley and Emoji on Images Tool - Tools
- Fix: Error creating bean with name securityConfig: Unsatisfied dependency expressed - NoSuchBeanDefinitionException: No qualifying bean of type - Java
- Git Config Command - A Deep Dive - Git
- Fix: TextEdit Open Html as Plain Text Code - MacOS
- Managed Metadata error - The data returned from the tagging UI was not formatted correctly - SharePoint
- Country ISO Codes List - Java
- Fix: nano is not recognized as an internal or external command - Windows PowerShell - Powershell
- How to show Videos on SharePoint Page - SharePoint