0

I used labels and policies in Data Governance. After I auto-published the label, I see the individual files in OneDrive getting tagged with a label.

I need to programmatically check if there are any labels associated with the file and categorize them. I don't see the labels data while querying through Graph as well.

https://graph.microsoft.com/v1.0/me/drive/root/children/test.txt

Do we have any powershell commands or REST API to get these data in granular level?

https://learn.microsoft.com/en-us/office365/securitycompliance/view-label-activity-for-documents?redi...

Thanks, Madhan

Jesse
  • 3,243
  • 1
  • 22
  • 29
madhantce
  • 3
  • 3

1 Answers1

0

Have you tried this for retrieving LabelActivity:

https://learn.microsoft.com/en-us/powershell/module/exchange/policy-and-compliance-retention/get-compliancetag?view=exchange-ps

For your first question on retrieving Labels from Graph, you can try the below query to check if it provides label info. I haven't tried myself.

GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}?expand=fields

You can constructSharePointId using the information from SharePointIds from the query below: https://graph.microsoft.com/v1.0/drive/root/children?$select=Name,sharepointIds

Pallav
  • 145
  • 7
  • Yes Pallav. I actually found a way through CSOM and SharePoint Rest API to get the column values for each files/folders. the above query provided by you also works. I was trying to find a way in the file/folder level which will reduce the complexity – madhantce Feb 14 '19 at 07:23