Forum Discussion

olivierbouchet's avatar
olivierbouchet
Copper Contributor
May 08, 2025
Solved

Purview Assign Label using GraphAPI premium

Hello !

I'm trying to use the following premium GraphApi call (assignsensitivitylabel)
to apply sensitivity labels to files on OneDrive and Sharepoint files. My application is correctly configured to use this premium/metered API (valid subscription, appropriate API permissions, no spending limits on billing account, etc) and I can call the API as documented. The problem is that, whatever file I try to label (docx, xlsx, pdf, pptx), I always encounter this error:

{
  "error": {
    "code": "notSupported",
    "message": "Sensitivity label cannot be assigned due to unsupported feature.",
    "innerError": {
      "code": "unprocessableEntity",
      "date": "2025-04-30T14:18:37",
      "request-id": "4424a42b-6253-4450-a0de-6344e722a16c",
      "client-request-id": "4424a42b-6253-4450-a0de-6344e722a16c"
    }
  }
}


For the sake of testing, I tried labeling a txt file and I got the expected error about the fact
that txt file is not a supported format so it makes me think that it really is trying to perform the labeling operation. If I download the file locally on my machine and perform the labeling operation using the Purview SDK (latest 1.16.149 version), it works as expected and the sensitivity label is applied so it's definitely not a problem with the files themselves. Can you give me some hints on what could prevent me to use the Graph API assignsensitivitylabel operation?
I looked like everywhere, ask GPTs, did and redid all the required steps to enable that API but with the same results all the time.

Thank you for your help!!

  • Hello Ankit365,

    Thanks for providing this check list.
    Since I've posted this question, I've gone this whole list again and figured out that AipService was not enabled in my tenant and that was the culprit.

    I wanted to close this question but I wasn't able to do so.
    Sorry for that.

    Thanks for your time!

2 Replies

  • Ankit365's avatar
    Ankit365
    Copper Contributor

    I would first check for Prereq before diving into specifics
    1: Metered API Access: You've enabled metered APIs for your application. This involves associating your app registration with an Azure subscription to allow billing for metered API usage.

    2: Appropriate Permissions: Your application has been granted the necessary permissions, such as Files.ReadWrite.All or Sites.ReadWrite.All.

    3: Supported File Types: You're attempting to label supported file types, specifically Office documents (.docx, .xlsx, .pptx) and PDFs. Note that older Office formats like .doc, .xls, and .ppt are not supported. 

    4: Sensitivity Labels Published: The sensitivity labels you're trying to apply are published and available to the users or groups in question.

    5: IRM Settings: Information Rights Management (IRM) is not interfering with the labeling process. Ensure that IRM is appropriately configured or disabled if necessary.

    • olivierbouchet's avatar
      olivierbouchet
      Copper Contributor

      Hello Ankit365,

      Thanks for providing this check list.
      Since I've posted this question, I've gone this whole list again and figured out that AipService was not enabled in my tenant and that was the culprit.

      I wanted to close this question but I wasn't able to do so.
      Sorry for that.

      Thanks for your time!

Resources