sensitivityLabel: extractContentLabel

Namespace: microsoft.graph.security

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Use the metadata that exists on an already-labeled piece of information to resolve the metadata to a specific sensitivity label. The contentInfo input is resolved to informationProtectionContentLabel.

Note

The contentLabel resource represents a sensitivity label that has been applied to a piece of information. sensitivityLabels objects are the abstract labels that are part of the organizational labeling policy and can be applied to the information.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) InformationProtectionPolicy.Read Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application InformationProtectionPolicy.Read.All Not available.

HTTP request

To extract the content label as the signed-in user (delegated permission) or a specified user (application permission):

POST /users/{usersId}/security/informationProtection/sensitivityLabels/extractContentLabel
POST /users/me/security/informationProtection/sensitivityLabels/extractContentLabel

To extract the content label as a service principal (application permission):

POST /users/security/informationProtection/sensitivityLabels/extractContentLabel

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-type Content-type: application/json. Required.
User-Agent Describes the name and version of the calling application. Details will surface in Azure Information Protection Analytics. Suggested format is ApplicationName/Version. Optional.

Request body

In the request body, supply a JSON representation of the parameters.

The following table shows the parameter that can be used with this action.

Parameter Type Description
contentInfo contentInfo Provides details about the content format, content state, and existing metadata as key-value pairs.

Response

If successful, this action returns a 200 OK response code and a contentLabel object in the response body.

Examples

Response

The following example shows the response.

POST https://graph.microsoft.com/beta/users/bob@contoso.com/security/informationProtection/sensitivityLabels/extractContentLabel
Content-type: application/json
User-agent: ContosoLOBApp/1.0

{
    "contentInfo": {
        "format": "default",
        "identifier": "MyDoc.docx",
        "state": "rest",
        "metadata": [
            {
                "name": "MSIP_Label_0ed12617-d0ef-4053-b8e4-ecf5bcf2ffb3_Enabled",
                "value": "True"
            },
            {
                "name": "MSIP_Label_0ed12617-d0ef-4053-b8e4-ecf5bcf2ffb3_Method",
                "value": "Standard"
            },
            {
                "name": "MSIP_Label_0ed12617-d0ef-4053-b8e4-ecf5bcf2ffb3_SetDate",
                "value": "1/1/0001 12:00:00 AM"
            },
            {
                "name": "MSIP_Label_0ed12617-d0ef-4053-b8e4-ecf5bcf2ffb3_SiteId",
                "value": "cfa4cf1d-a337-4481-aa99-19d8f3d63f7c"
            },
            {
                "name": "MSIP_Label_0ed12617-d0ef-4053-b8e4-ecf5bcf2ffb3_Name",
                "value": "LabelScopedToBob_Tests"
            },
            {
                "name": "MSIP_Label_0ed12617-d0ef-4053-b8e4-ecf5bcf2ffb3_ContentBits",
                "value": "0"
            },
            {
                "name": "MSIP_Label_0ed12617-d0ef-4053-b8e4-ecf5bcf2ffb3_ActionId",
                "value": "00000000-0000-0000-0000-000000000000"
            }
        ]
    }
}

Response

The following example shows the response.

HTTP/1.1 200 OK
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#microsoft.graph.security.contentLabel",
    "createdDateTime": "2001-01-01T12:00:00Z",
    "assignmentMethod": "standard",
    "sensitivityLabelId": "0ed12617-d0ef-4053-b8e4-ecf5bcf2ffb3"
}