How to query and retrieve SharePoint List Item by Itemd ID using PowerShell / Management Shell / PnP PowerShell ?
There are multiple ways
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.
$web = Get-SPWeb <SITE URL> $list = $web.GetList("<LIST NAME>") $list.GetItemById(<ITEM ID>)
SITE URL = URL of SharePoint Site (string)
LIST NAME = Name of SharePoint List (string)
ITEM ID = Number of Item Id (integer)
Using PnP Get-PnPListItemGet-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.
More Posts related to SharePoint,
- Move Copy Migrate SharePoint OneDrive files folders to different site collection location
- How to generate client id and secret to register SharePoint App with OAuth
- How to share SharePoint site or document with all users in organization
- Get-ADUser PowerShell - Get AD user details using email address
- error CAML Query containing special characters
- Access URL for SharePoint Tenant Admin Center (Online Office 365)
- Fix SharePoint Error - The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started
- 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.
- How to delete SharePoint List Item programmatically using C#.Net
- How to Share Microsoft SharePoint Site with Users or Groups
- JSON column formatting to preview SharePoint Online file on mouse hover
- SharePoint List redirect user after submitting form NewForm.aspx
- See actual SharePoint error exception modify web.config
- SharePoint Server 2016 IT Preview Deprecated Removed features
- How to create SharePoint Document Library
- How to Get or Set SharePoint Document ID _dlc_DocId using PowerShell
- How to disable SharePoint subsite creation option for owners
- PowerShell - How to use Try Catch Finally blocks for error exception handling (Windows/SharePoint)
- SharePoint error - Your organization doesn't allow sharing with users from this domain. Please contact your IT department for help. (OSE403)
- [Solved] SharePoint Search Internal server error exception
- How to wrap column text in SharePoint Online Modern List Grid View using JSON formatting
- How to extend retiring SharePoint 2010 Workflows and continue with Office 365
- Changed AD user display name showing old name in SharePoint
- How to hide or remove quick launch left navigation from SharePoint Online Modern site page
- How to enable anonymous public access for SharePoint Online site collection, file, folder without login ?
- How to enter Rockstar Activation Code? - HowTos
- How to Access Terminal (Command Line) in Eclipse IDE - Eclipse
- Error: Unable to access jarfile jarFileName.jar file [Windows] - Java
- iPhone Message: A new iOS update is now available. Please update from the iOS 14 beta. - Apple
- [Event Log] Android Studio performance could be improved - Android-Studio
- How to display Toast in a thread : Android - Android
- Save a Notepad file as Microsoft Excel file - Microsoft
- How to Word-Warp Console logs in IntelliJ - Java