Effective List Item Updates with Set-PnPListItem

In this post, we’ll have a look at a specific cmdlet: Set-PnPListItem.

We have a couple of interesting parameters (including the -Batch one!), depending on what we’re trying to do. If you used this cmdlet before, and particularly to update something without creating a new version of the file, we used the -SystemUpdate parameter which I’ve found great and really useful.

Now we have new ones which are under -UpdateType:

  • Update: Sets field values and creates a new version if versioning is enabled for the list
  • SystemUpdate: Sets field values and does not create a new version. Any events on the list will trigger
  • UpdateOverwriteVersion: Sets field values and does not create a new version. No events on the list will trigger.

UpdateType Update

Below you can see how the original item’s version was (3.0), and how it changed after running the command with -UpdateType Update. This is what you would normally expect when updating an item, the version increments.

Set-PnPListItem -List "PnP Blog List" -Identity 1 -Values @{"Title" = "HelloWorld123"} -UpdateType Update

UpdateType SystemUpdate or UpdateOverwriteVersion

The starting point being the screenshot above (with version 4.0), running one or the other SystemUpdate or UpdateOverwriteVersion will have same effect if you have no flows or automation attached to the item.

If you do, and you don’t want it to be triggered, used -UpdateType UpdateOverwriteVersion

Thanks for reading! 🙂

Discover more from Veronique's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading