Dear @Andreas Davros
Welcome to Microsoft Q&A Forum!
Thanks for the thoughtful question and documentation can cause confusion here, so let me give you some insights based on my research:
- Assigning a label to a SharePoint/OneDrive file uses
driveItem: assignSensitivityLabel, which is an advanced, protected, and metered API. You must enable Metered APIs and services for the calling app (Azure subscription linked to the app), and the app needs permissions likeFiles.ReadWrite.All/Sites.ReadWrite.All. It may be considered a write operation that uses advanced compliance features. These operations fall under metered APIs because they consume additional compliance resources and may incur throttling or billing implications. - Reading sensitivity labels (retrieving metadata) is a read-only operation. It typically does not require metered API enablement, as it doesn’t trigger compliance processing or classification logic. Reading a label uses
driveItem: extractSensitivityLabels. This is a standard read operation, not listed as metered, and works withFiles.Read.All(or higher) without the metered setup.
So, in this concern:
- Enabling metered APIs is required for assigning labels because it’s a premium compliance feature.
- Enabling metered APIs is not required for reading labels; you can retrieve sensitivity label info without enabling metered APIs.
- If you only need to get labels: use
extractSensitivityLabels; confirm supported file types (Office + PDF) and permissions. - If you need to set labels: ensure Purview labels are published and SP/OD labeling is enabled; then enable Metered APIs and call
assignSensitivityLabel.
Official references:
- Assign (metered): driveItem: assignSensitivityLabel
- Enable metered APIs: Enable metered APIs and services
- Metered API overview & list (shows assignSensitivityLabel still metered): Overview and Metered API list
- Read labels: driveItem: extractSensitivityLabels
- Enable labeling in SharePoint/OneDrive: Enable sensitivity labels for files in SharePoint and OneDrive
Hope this helps and please feel free to let me know any questions in comment sections. Wish you a pleasant day!
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.