Update a SharePoint list item without changing the Modified By and Modified fields
Demonstrates how to update a SharePoint list item without changing the Modified By and Modified fields using PnP PowerShell.
Summary
This script updates a single list item in a SharePoint list using the SystemUpdate update type which doesn't update the Modified By and Modified fields or trigger any Power Automate flows.
To use this script you will have to replace the values for the following placeholders:
<SITE_URL>: the URL of the site where the list is located.<LIST_NAME>: the name of the list where the item is located.<LIST_ITEM_ID>: the ID of the item to update, this is an integer value.<FIELD_INTERNAL_NAME>: the internal name of the field to update.<VALUE_TO_SET>: the value to set for the field.
# Define the site URL
$SiteURL = "<SITE_URL>"
# Set the list name where the item is located
$ListName = "<LIST_NAME>"
# Set the ID of the item to update
$ItemID = <LIST_ITEM_ID>
# Connect to SharePoint Online
Connect-PnPOnline -Url $SiteURL -Interactive
# Update the List Item with "SystemUpdate" so it wont update Modified By and Modified fields or trigger any Power Automate flows
Set-PnPListItem -List $ListName -Identity $ItemID -Values @{ "<FIELD_INTERNAL_NAME>" = "<VALUE_TO_SET>"} -UpdateType SystemUpdate
# Disconnect from SharePoint Online
Disconnect-PnPOnline
Contributors
| Author(s) |
|---|
| Guido Zambarda |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
Tool documentation & references
- Want to learn more about PnP PowerShell and the cmdlets
Check out the PnP PowerShell site to get started and for the reference to the cmdlets.