Get sensitivity label of word, excel, powerpoint file when upload to SharePoint online

Job ID: 35386388

Budget: $30 – $250 USD

We are developing an web app, deploy to SharePoint online using SharePoint designer. It has this functionality: only office files (docx, xlsx, pptx) with appropriate sensitivity label are allowed to upload to a SharePoint online document library.

We are following this guide: https://learn.microsoft.com/en-us/answers/questions/257636/get-retention-policy-labels-from-files-or-librarie.html. We call _api/web/lists/getByTitle('<name>')/items(<id>)/FieldValuesAsText and check the MetaInfo field of the response.

The issue is, the API sometimes response with no info of the sensitivity label of the file, for unknown reason.

We want a better solution to detect the sensitivity label of the uploaded file, with the following criteria:
1. No additional server needed
2. If the solution need additional APIs, we can deploy to Azure Function (NodeJS or C# environment).

If you have a solution for this, please contact us.