命名空间:microsoft.graph
获取授予调用用户的具有管理员定义权限的特定敏感度标签的使用权限。
在调用此 API 之前,请确保你的组织满足以下要求:
-
条件访问配置: 如果你的组织使用限制对云应用程序访问的 Microsoft Entra 条件访问策略,请从适用的策略中排除 Microsoft 信息保护同步服务 (MIP 同步服务) 、应用程序 ID
870c4f2e-85b6-4d43-bdda-6ed9a579b725。 否则,这些策略可能会阻止敏感度标签和使用权限评估,从而导致授权失败。
-
Rights Management 激活: 确保已为组织激活 Azure Rights Management (Azure RMS) 。 敏感度标签保护和权限评估需要 Azure RMS。
API 可用性
此 API 可用于以下国家级云部署。
| 全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
| ✅ |
❌ |
❌ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委托权限的详细信息,请参阅 权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
| 权限类型 |
最低特权权限 |
更高特权权限 |
| 委派(工作或学校帐户) |
SensitivityLabel.Read |
SensitivityLabels.Read.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
| 应用程序 |
SensitivityLabel.Read |
SensitivityLabels.Read.All |
HTTP 请求
GET /security/dataSecurityAndGovernance/sensitivityLabels/{labelId}/rights
| 名称 |
说明 |
| Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
| 客户端请求 ID |
可选。 客户端生成的用于跟踪请求的 GUID。 建议用于故障排除。 |
可选的查询参数
此方法支持一些 OData 查询参数来帮助自定义响应。 若要了解一般信息,请参阅 OData 查询参数。
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法将在响应正文中返回响应 200 OK 代码和 usageRights 枚举值的集合,表示为指定标签授予用户的权限。
如果找不到标签、没有管理员定义的保护或用户VIEW没有权限,则 API 可能会返回错误响应 (,或者 404 Not Found) 403 Forbidden 错误对象中包含详细信息。
示例
请求获取用户的特定敏感度标签 4e4234dd-377b-42a3-935b-0e42f138fa23 的权限。
请求
GET https://graph.microsoft.com/v1.0/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");
});
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphsecurity "github.com/microsoftgraph/msgraph-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)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// 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");
});
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
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')
.header('Authorization','Bearer {token}')
.header('Client-Request-Id','7c9b1b4c-5b5a-4e3e-9f1b-2d9b0b4a9a0a')
.get();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\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();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Security
Get-MgSecurityDataSecurityAndGovernanceSensitivityLabelRight -SensitivityLabelId $sensitivityLabelId -Owneremail "bob@contoso.com"
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.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)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
下面的示例显示了包含授予用户的使用权限的响应。
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.usageRights)",
"id": "f306e677-4c14-4136-b2c3-d9c7dd448cc1",
"ownerEmail": "bob@contoso.com",
"value": "docEdit, edit, forward, print, reply, replyAll, view, extract, viewRightsData, objModel"
}