Namespace: microsoft.graph
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.
Get the usage rights granted to the calling user for a specific sensitivity label that has admin-defined permissions.
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 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) |
SensitivityLabel.Read |
SensitivityLabels.Read.All |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
SensitivityLabel.Read |
SensitivityLabels.Read.All |
HTTP request
GET /security/dataSecurityAndGovernance/sensitivityLabels/{labelId}/rights
Name |
Description |
Authorization |
Bearer {token}. Required. Learn more about authentication and authorization. |
Client-Request-Id |
Optional. A client-generated GUID to trace the request. Recommended for troubleshooting. |
Optional query parameters
This method supports some of the OData query parameters to help customize the response. For general information, see OData query parameters.
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a collection of usageRight enum values in the response body, representing the rights granted to the user for the specified label.
If the label is not found, doesn't have admin-defined protection, or the user doesn't have the VIEW
right, the API might return an error response (for example, 403 Forbidden
or 404 Not Found
) with details in an error object.
Examples
Request to get the rights for a specific sensitivity label for the user 4e4234dd-377b-42a3-935b-0e42f138fa23
Request
GET https://graph.microsoft.com/beta/security/dataSecurityAndGovernance/sensitivityLabels/4e4234dd-377b-42a3-935b-0e42f138fa23/rights?ownerEmail=bob@contoso.com
Authorization: Bearer {token}
Client-Request-Id: 7c9b1b4c-5b5a-4e3e-9f1b-2d9b0b4a9a0a
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Security.DataSecurityAndGovernance.SensitivityLabels["{sensitivityLabel-id}"].Rights.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.OwnerEmail = "bob@contoso.com";
requestConfiguration.Headers.Add("Authorization", "Bearer {token}");
requestConfiguration.Headers.Add("Client-Request-Id", "7c9b1b4c-5b5a-4e3e-9f1b-2d9b0b4a9a0a");
});
mgc-beta security data-security-and-governance sensitivity-labels rights get --sensitivity-label-id {sensitivityLabel-id}
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphsecurity "github.com/microsoftgraph/msgraph-beta-sdk-go/security"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("Authorization", "Bearer {token}")
headers.Add("Client-Request-Id", "7c9b1b4c-5b5a-4e3e-9f1b-2d9b0b4a9a0a")
requestOwnerEmail := "bob@contoso.com"
requestParameters := &graphsecurity.DataSecurityAndGovernanceSensitivityLabelsItemRightsRequestBuilderGetQueryParameters{
OwnerEmail: &requestOwnerEmail,
}
configuration := &graphsecurity.DataSecurityAndGovernanceSensitivityLabelsItemRightsRequestBuilderGetRequestConfiguration{
Headers: headers,
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
rights, err := graphClient.Security().DataSecurityAndGovernance().SensitivityLabels().BySensitivityLabelId("sensitivityLabel-id").Rights().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UsageRightsIncluded result = graphClient.security().dataSecurityAndGovernance().sensitivityLabels().bySensitivityLabelId("{sensitivityLabel-id}").rights().get(requestConfiguration -> {
requestConfiguration.queryParameters.ownerEmail = "bob@contoso.com";
requestConfiguration.headers.add("Authorization", "Bearer {token}");
requestConfiguration.headers.add("Client-Request-Id", "7c9b1b4c-5b5a-4e3e-9f1b-2d9b0b4a9a0a");
});
const options = {
authProvider,
};
const client = Client.init(options);
let usageRightsIncluded = await client.api('/security/dataSecurityAndGovernance/sensitivityLabels/4e4234dd-377b-42a3-935b-0e42f138fa23/rights?ownerEmail=bob@contoso.com')
.version('beta')
.header('Authorization','Bearer {token}')
.header('Client-Request-Id','7c9b1b4c-5b5a-4e3e-9f1b-2d9b0b4a9a0a')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Security\DataSecurityAndGovernance\SensitivityLabels\Item\Rights\RightsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new RightsRequestBuilderGetRequestConfiguration();
$headers = [
'Authorization' => 'Bearer {token}',
'Client-Request-Id' => '7c9b1b4c-5b5a-4e3e-9f1b-2d9b0b4a9a0a',
];
$requestConfiguration->headers = $headers;
$queryParameters = RightsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->ownerEmail = "bob@contoso.com";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->security()->dataSecurityAndGovernance()->sensitivityLabels()->bySensitivityLabelId('sensitivityLabel-id')->rights()->get($requestConfiguration)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.security.data_security_and_governance.sensitivity_labels.item.rights.rights_request_builder import RightsRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = RightsRequestBuilder.RightsRequestBuilderGetQueryParameters(
owner_email = "bob@contoso.com",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
request_configuration.headers.add("Authorization", "Bearer {token}")
request_configuration.headers.add("Client-Request-Id", "7c9b1b4c-5b5a-4e3e-9f1b-2d9b0b4a9a0a")
result = await graph_client.security.data_security_and_governance.sensitivity_labels.by_sensitivity_label_id('sensitivityLabel-id').rights.get(request_configuration = request_configuration)
Response
The following example shows the response containing the usage rights granted to the user.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.usageRight)",
"id": "f306e677-4c14-4136-b2c3-d9c7dd448cc1",
"ownerEmail": "bob@contoso.com",
"value": "docEdit, edit, forward, print, reply, replyAll, view, extract, viewRightsData, objModel"
}