Update SharePoint folder without creating a new version

2024-08-03

Introduction

PnP Powershell module allows you now to update your SharePoint Online folders without creating a new version or triggering a workflow.



Update a folder

Using the following code you can update a folder without changing the Modified field and without triggering a workflow. The difference between the two examples lies in the parameter -UpdateType UpdateOverwriteVersion used here.

# Connect to the SharePoint site
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/yoursite" -Interactive

# Get the folder you want to update
$folder = Get-PnPFolder -Url "/sites/yoursite/Shared Documents/YourFolder"

# Update the folder's metadata (e.g., Title or any custom metadata)
Set-PnPListItem -List "Shared Documents" -Identity $folder.ListItemAllFields.Id -Values @{"Title"="New Folder Title"} -UpdateType UpdateOverwriteVersion



Using the following code you can update a folder without changing the Modified field. It triggers any associated workflow or event. The difference between the two examples lies in the parameter -UpdateType SystemUpdate used here.

# Connect to the SharePoint site
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/yoursite" -Interactive

# Get the folder you want to update
$folder = Get-PnPFolder -Url "/sites/yoursite/Shared Documents/YourFolder"

# Update the folder's metadata (e.g., Title or any custom metadata)
Set-PnPListItem -List "Shared Documents" -Identity $folder.ListItemAllFields.Id -Values @{"Title"="New Folder Title"} -UpdateType SystemUpdate



Update folder permissions

Using PowerShell and the PnP.PowerShell module, you can update a folder’s permissions without creating a new version by using the Set-PnPFolderPermission cmdlet with the [-SystemUpdate] parameter.


# Connect to the SharePoint site
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/yoursite" -Interactive

# Update the folder's metadata (e.g., Title or any custom metadata)
Set-PnPFolderPermission -List "Shared Documents" -Identity "/sites/yoursite/Shared Documents/YourFolder" -User "user@domain.com" -AddRole "Contribute" -SystemUpdate

Explanation

-SystemUpdate switch parameter ensures the update is made without creating a new version of the folder.

See Also

Set-PnPFolderPermission