GitHub Icon Image
GitHub

Update a SharePoint list item without changing the Modified By and Modified fields

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.
  • PnP PowerShell

# 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

Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell

The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?

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.

Back to top Script Samples
Generated by DocFX with Material UI