本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
检索 informationProtectionLabel 对象的属性和关系。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
InformationProtectionPolicy.Read
委派(个人 Microsoft 帐户)
不支持。
应用程序
InformationProtectionPolicy.Read.All
HTTP 请求
若要获取已登录用户或指定用户可用的标签,请执行以下操作:
GET /me/informationProtection/policy/labels/{id}
GET /users/{id | user-principal-name}/informationProtection/policy/labels/{id}
若要获取可供组织使用的标签,请执行以下操作:
GET /informationProtection/policy/labels/{id}
可选的查询参数
此方法支持一些 OData 查询参数来帮助自定义响应。 若要了解一般信息,请参阅 OData 查询参数 。
名称
说明
Authorization
Bearer {token}。必需。
User-Agent
描述调用应用程序的名称和版本。 详细信息将在 Azure 信息保护分析中显示。 建议的格式为 ApplicationName/Version。 可选。
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回 200 OK 响应代码和请求 的信息ProtectionLabel 对象。
示例
请求
下面展示了示例请求。
GET https://graph.microsoft.com/beta/me/informationprotection/policy/labels/{id}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var informationProtectionLabel = await graphClient.Me.InformationProtection.Policy.Labels["{informationProtectionLabel-id}"]
.Request()
.GetAsync();
const options = {
authProvider,
};
const client = Client.init(options);
let informationProtectionLabel = await client.api('/me/informationprotection/policy/labels/{id}')
.version('beta')
.get();
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/informationprotection/policy/labels/{id}"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
MSGraphInformationProtectionLabel *informationProtectionLabel = [[MSGraphInformationProtectionLabel alloc] initWithData:data error:&nserror];
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
InformationProtectionLabel informationProtectionLabel = graphClient.me().informationProtection().policy().labels("{id}")
.buildRequest()
.get();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
informationProtectionLabelId := "informationProtectionLabel-id"
result, err := graphClient.Me().InformationProtection().Policy().LabelsById(&informationProtectionLabelId).Get()
Import-Module Microsoft.Graph.Identity.SignIns
# A UPN can also be used as -UserId.
Get-MgUserInformationProtectionPolicyLabel -UserId $userId -InformationProtectionLabelId $informationProtectionLabelId
响应
下面展示了示例响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
User-agent: ContosoLOBApp/1.0
{
"id": "4b18e8bb-b4a5-4695-85d0-8ae23ef27892",
"name": "Highly Confidential",
"description": "Consult Contoso data labeling policy for more details.",
"color": "",
"sensitivity": 3,
"tooltip": "Data classified as Contoso Highly Confidential.",
"isActive": true,
"parent": null
}