A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Based on your description, I understand that you want to get file sensitivity label information into csv file.
Per my research, you could use PowerShell to list any excel and word documents with sensitivity label in a folder copied by SharePoint Online or OneDrive.
Report = @()
$Files = (Get-ChildItem -Path "c:\temp\" -Include *.docx, *.xlsx -Recurse)
ForEach ($F in $Files) {
$FileName = "C:\Temp\" + $F.Name
$TemplateName = $Null
$Status = (Get-AipFileStatus -Path $FileName)
If ($Status.IsLabeled -ne $False) {
If ($Status.RmsTemplateId -ne $Null) {
$TemplateId = [GUID]($Status.RMSTemplateId)
$TemplateName = (Get-RMSTemplate -Identity $TemplateId.Guid ErrorAction SilentlyContinue ).Name }
$ReportLine = [PSCustomObject]@{
File = $F.Name
IsLabeled = $Status.IsLabeled
LabelId = $Status.MainLabelId
Label = $Status.MainLabelName
Date = $Status.LabelDate
RMSGuid = $Status.RMSTemplateId
RMSTemplate = $TemplateName
Owner = $Status.RMSOwner }
$Report += $ReportLine
}}
$Report | Export-CSV -NoTypeInformation c:\Temp\LabeledFiles.csv
Reference: https://office365itpros.com/2018/11/19/reporting-protected-files/
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.