The task is to write a code that applies a sensitivity label to a document in a SharePoint Online document library without downloading the file.
I have explored the following APIs so far:
- SharePoint REST API v1: Can be used to set a Retention label but not a Sensitivity label.
- Microsoft Graph REST API: Can’t find any public methods for setting any labels in this API. All label-related properties seem to be read-only.
- Microsoft Information Protection (MIP) SDK: Sensitivity labels can be applied to a local file. A stream (e.g. memory stream) is also accepted as input/output so it is possible to apply labels in memory. But it still requires downloading the file from SharePoint.