Cannot call this API, Access is restricted to Payg enabled apps only error when using sensitive label api for one drive

Anonymous
2023-03-20T10:18:46.77+00:00

Hi,

I'm using the graph apply sensitive label api to add sensitivity label to one drive file using below api

POST https://graph.microsoft.com/beta/drives/{$driveId}/items/{$itemId}/assignSensitivityLabel

--body 'sensitivityLabelId' => $labelId

I getting below error when i call this api

{"error":{"code":"accessDenied","message":"Cannot call this API, Access is restricted to Payg enabled apps only.","innerError":{"date":"2023-03-20T10:06:03","request-id":"607c194b-20a7-4b34-b432-7d2a75064f66","client-request-id":"607c194b-20a7-4b34-b432-7d2a75064f66"}}}

though the get request with following api works fine

Get https://graph.microsoft.com/beta/security/informationProtection/sensitivityLabels

getting success response with available labels from this endpoint.

Any help would be appreciated.

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,272 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,142 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,821 questions
0 comments No comments
{count} votes

Accepted answer
  1. CharanyaB-MSFT 1,891 Reputation points Microsoft Vendor
    2023-03-20T11:26:41.63+00:00

    Hello @Usman Malik,

    Thanks for reaching out!

    assignSensitivityLabel is a metered API and some charges for use may apply. Before you call this API, you must request access. Once the request is approved, please follow the steps from the below document to consume metered APIs and services in Microsoft Graph.

    https://learn.microsoft.com/en-us/graph/metered-api-setup

    Hope this helps.

    If the reply is helpful, please click "Accept Answer" and kindly upvote it. If you have additional questions about this answer, please click "Comment".


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.