Create Sensitivity Labels applied to Files report
How to create a sensitivity label report in the SharePoint Online Admin Centre using a Power Automate flow.
URI
_api/v2.1/tenants/default/analyticsReports/createLabelReport |
Headers
{ | |
"Accept": "application/json;odata=verbose", | |
"Content-Type": "application/json;odata=verbose" | |
} |
Body
{ | |
"format": "FullDetails", | |
"type": "Snapshot", | |
"labelId": "5e06f0a7-9d7b-4dfe-bc22-bb1a43a1ff46", | |
"labelName": "Highly Confidential" | |
} |
Screenshot with example
Sample data
Site Address – https://contoso-admin.sharepoint.com (Admin Centre Url)
labelName – Highly Confidential
labelId – 5e06f0a7-9d7b-4dfe-bc22-bb1a43a1ff46
Copy/paste example
{"id":"455ae178-ee75-47ed-bd40-e0050db38f00","brandColor":"#036C70","connectionReferences":{"shared_sharepointonline":{"connection":{"id":"/exp_sharedsharepointonline_e5efa"}}},"connectorDisplayName":"SharePoint","icon":"https://connectoricons-prod.azureedge.net/releases/v1.0.1664/1.0.1664.3477/sharepointonline/icon.png","isTrigger":false,"operationName":"Send_an_HTTP_request_to_SharePoint","operationDefinition":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_sharepointonline","operationId":"HttpRequest","apiId":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"},"parameters":{"dataset":"@parameters('SPO_AdminCentre_Url (ubs_SPO_AdminCentre_Url)')","parameters/method":"POST","parameters/uri":"_api/v2.1/tenants/default/analyticsReports/createLabelReport","parameters/headers":{"Accept":"application/json;odata=verbose","Content-Type":"application/json;odata=verbose"},"parameters/body":"{\n\"format\": \"FullDetails\",\n\"type\": \"Snapshot\",\n\"labelId\": \"5e06f0a7-9d7b-4dfe-bc22-bb1a43a1ff46\",\n\"labelName\": \"Highly Confidential\"\n}"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{}}} |
Resources
Sensitivity Labels for files reports
That’s it, Happy testing!
Hi Dennis, can I ask if you can run this against specific SP site by manual trigger? and Also how can I get the output from this, is it file is it html report, is it email that I can send with the results? Thanks Darko