Nov 15 2022 06:39 PM
I have a need to make a change to document retention in SharePoint. I need to deprecate use of an existing retention label with retention type "EventAgeInDays" and have users begin labeling content based on a retention type of "TaggedAgeinDays" instead. The shortcut appears to be simply modifying the existing label in the FilePlan. It appears to solve for a number of issues like having to retrain the users to pick a new label name. I have tried the change in my development tenant, and I received no errors. I presume the content labeled before the change will continue with the old parameters of the label. Only newly labeled content would get the change. This seems almost too easy. Is there a preferred way to handle such an alteration? Did I just light the fuse on a process that is bound to fail when SharePoint runs the weekly housekeeping?
Nov 28 2022 09:05 AM
SolutionHi @K-dub,
Thanks for the question! Here is a link to the documentation about modifying existing labels: Create retention labels for exceptions - Microsoft Purview (compliance) | Microsoft Learn
"Most settings can't be changed after the label is created and saved, which include:
So, you can change the retention period for a label, but nothing else. If you'd like to change the other settings, the best process is to create a new label and use PowerShell to replace it 1:1 with the old label.
Please let us know if you have other questions.
Thanks!
Erica
Jan 18 2023 06:23 AM
Hey @EricaToelle! I hope everything's well with you! This is relevant to my interests. I'm going to have to show a client how to do do this soon (create the new labels and use PowerShell to replace them 1:1). Do you have any advice on what thread to start pulling to figure out how to do that?
Jan 31 2023 02:33 PM
@Nick Brattoli Consider using the Set-PnPListItem cmdlet with the '-ClearLabel' and/or the '-Label' params to clear or assign a new retention label on an existing list item.
Refer this example: Set-PnPListItem | PnP PowerShell
Hope that helps! Cheers!
Nov 14 2023 07:56 AM
@Kuljeet Singh @EricaToelle - I've the same requirement where I've to update/replace the old retention label with the new one that has been already applied to the content.
For this purpose I'm using PowerShell script and below is the error. Can you please assist me here?
ERROR: "Set-PnPListItem : Invalid data has been used to update the list item. The field you are trying to update may be read only."
PnP:
# Get all the items that have the old retention label
$items = Get-PnPListItem -List $libraryName -Query "<View><Query><Where><Eq><FieldRef Name='_ComplianceTag' /><Value Type='Choice'>$oldRetentionLabel</Value></Eq></Where></Query></View>"
foreach ($item in $items) {
# Update the retention label to the new one
Set-PnPListItem -List $libraryName -Identity $item.Id -Values @{"_ComplianceTag" = $newRetentionLabel}
}
Nov 14 2023 09:10 AM
@ellan1537 The records management product team does not recommend using PnP to work with retention labels. Please use the supported methods in the official documentation: https://aka.ms/DLM/CSOM.
We also introduced Methods to the driveitem object in SharePoint to apply and manage retention labels applied to items in SharePoint:
Nov 14 2023 09:11 AM
Nov 28 2022 09:05 AM
SolutionHi @K-dub,
Thanks for the question! Here is a link to the documentation about modifying existing labels: Create retention labels for exceptions - Microsoft Purview (compliance) | Microsoft Learn
"Most settings can't be changed after the label is created and saved, which include:
So, you can change the retention period for a label, but nothing else. If you'd like to change the other settings, the best process is to create a new label and use PowerShell to replace it 1:1 with the old label.
Please let us know if you have other questions.
Thanks!
Erica