Sep 14 2021
09:17 AM
- last edited on
Feb 01 2023
01:58 PM
by
TechCommunityAP
Sep 14 2021
09:17 AM
- last edited on
Feb 01 2023
01:58 PM
by
TechCommunityAP
Is it possible to apply sensitivity labels to documents in SharePoint (not sites or groups) using PowerShell?
Feb 24 2022 01:04 AM - edited Feb 24 2022 01:39 AM
@WJN78 Assuming the document is in SharePoint.
Unlock-SensitivityLabelEncryptedFile (SharePointOnlinePowerShell) | Microsoft Docs
Remove encryption for a labeled document
Might as well add this too (RMS to unified labeling cmdlet mapping)
Use PowerShell with the Azure Information Protection unified labeling client | Microsoft Docs
Nov 22 2023 11:03 AM
@Niraj Tenany Can you share your approach? we are trying to use the same approach where find files with sensitivity label X and replace it with sensitivity label Y.
Nov 22 2023 01:35 PM
Here is an example:
# Define the folder path and label IDs
$folderPath = "C:\temp\fileswithlabels"
$currentLabelId = "<Current_Label_GUID>" # Replace with the GUID of label X
$newLabelId = "<New_Label_GUID>" # Replace with the GUID of label Y
# Iterate over each file in the folder
Get-ChildItem -Path $folderPath -File | ForEach-Object {
$file = $_.FullName
# Check if the current file has the target label
$fileStatus = Get-AIPFileStatus -Path $file
if ($fileStatus.LabelId -eq $currentLabelId) {
try {
# Apply the new label
Set-AIPFileLabel -Path $file -LabelId $newLabelId
Write-Host "Label changed for file: $file"
} catch {
Write-Host "Failed to change label for file: $file"
}
}
}
Requirement: AIPService Module for Powershell.
Jan 04 2024 04:25 PM
@VasilMichev I acknowledge that this is old thread.
I have 400+ local word docs that I need to apply label to.
I have done that via set-APIfilelabel cmdlet but when I open those docs in words , its not adding label to the header like it does if I was to manually open file and apply label.
Is there a way to user PowerShell to apply label and also display for word docs?
Regards,
Hari